Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM: How to delete 3 words from the end of line in normal mode?

Tags:

vim

What is the shortest combo?

P.S. I usually do ACtrl+wCtrl+wCtrl+wEsc.
In other words, I have to jump into Insert mode.

P.P.S. d3b doesn't work.

like image 733
cutalion Avatar asked Jan 20 '13 18:01

cutalion


2 Answers

This sequence of commands,

$3bD

is the shortest way to do it I can think of at the moment but it leaves out an ugly trailing space.

$3gelD

is another way that gets rid of the trailing space.

You can also think outside the box and play with spaces instead of words:

$3F D
like image 191
romainl Avatar answered Nov 16 '22 01:11

romainl


$ 3b D which translates to

  • $ to the end of a line
  • 3 three of whatever is next
  • b backward three [one without modifier] words
  • D delete the characters under the cursor until the end of the line

In addition, you can also use the normal command in ex mode to achieve the same

:norm! $3bD
like image 33
Konrad Reiche Avatar answered Nov 16 '22 01:11

Konrad Reiche