7
2
My cursor is on the final character of a word in Vim. Without moving the cursor, is there any succinct way to delete the current word and the word before it?
As far as I can tell, the only way to delete the current word is to use diw
. Using db
leaves the character under the cursor (which happens to be the last character).
Wow! I didn't realize that the final character would be highlighted in visual mode, considering it is not highlighted in normal mode. I had always assumed that operators had the same meaning in visual mode. – wanttobegoodatvim – 2011-09-12T17:53:49.683
Yes, visual selection always includes the current character. I think it's more logical than
d
's behaviour to include the current character when going to the right and exclude it when going to the left. This behaviour is quite coherent withy
andc
's own behaviour but (IMHO) not really with the general idea of "the cursor is ON a letter". This "discrepancy" is another reason why I like to use visual selection. – romainl – 2011-09-12T19:39:54.117