Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Vim, how to delete the suffix of a word?

In vim, in normal mode, if the cursor is in a word, not the last letter, de deletes the suffix of the word, from the position of the cursor. If the cursor is on the last letter, x does it too, while de would jump to the end of the next word.

What command would you use that would work in both cases, last letter or not?

The purpose is to include the command in a macro.

like image 603
galath Avatar asked May 22 '11 08:05

galath


1 Answers

Try vwged instead of de, and define a mapping like the following, if you like it.

:nnoremap <leader>de vwged

It seems to do exactly what you want.

like image 112
ib. Avatar answered Oct 06 '22 01:10

ib.