Kalcifer
Kalcifer

Reputation: 1640

Vim Delete From the Character Directly After the First Character of a Word Until the End of the Word

Say I have

word
^ Cursor Here

and I want it to be

w

If I use de I end up just deleting the entire word. I could just press the right arrow key once but that requires me to lift my hands defeats the purpose. I Need a way to delete from the character directly following until the end of the word. I could be overdoing it a little here though.

Upvotes: 0

Views: 1037

Answers (2)

mattb
mattb

Reputation: 3062

The problem here is that you're using the arrow keys to move rather than hjkl keys.

While it feels very wrong to use them when you've been used to the arrow keys from so many other programs, it only takes a week or two of forcing yourself to use hjkl. Once that's done, the benefits are with you for every extra second, minute, hour you spend in vim for as long as you use it as your editor.

In your case you would just type lde to move right one character, and delete to the beginning of the next word.

Upvotes: 1

wxz
wxz

Reputation: 2546

If you do a remap, then you can create a shortcut for it. For instance:

noremap <C-t> :norm lde<Cr>

will remap ctrl+t to move right with l, delete to end de, then enter <CR>. This assumes your cursor is at the beginning of a word.

Upvotes: 2

Related Questions