^ denotes char under cursor for vim
Please dont answer with T motion because it will require me to know the last character , which helps me but I want to know if there is any other way
I have a line of text:
these are test words
now if I want to delete the word test.
If my cursor is at the beginning of the word
these are test words
^
I press dw it does exactly what I want, deletes test and spaces after it till next word ie ‘words’, I understand this works because w motion is exclusive and it doesn’t include the beginning character of next word
However if I am at end of the word then how can I delete towards left direction and remove those white spaces (between are and ‘test’ as well):
these are test words
^
when I press dgE it deletes the e at the end of are as it tries to reach the end of previous word and deletes it as well, resulting in
these ar words
I tried to force this command to be exclusive but it excludes on right side and not on left side
I want end result to be:
these are words
Please dont answer with T or F motion
>Solution :
Press daw (mnemo: delete a word) as explained in :help aw. It will delete the entire word and the white space behind it.