Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In vim, with

dg_

you can delete the actual cursor position to end of line. How can I delete the actual position to end of line minus some number of characters?

example:

this<cursor> is a ... many words ... line

How do I delete from <cursor> position to li of line word?

share|improve this question
up vote 2 down vote accepted

Say for 4 characters:

v$4hd
  • v - visual / select mode.
  • $ - go to end of line.
  • 4h - step back 4 chars.
  • d - delete selection.

Or you can just say skip the last word:

v$bhd

That will leave only the last word standing.

share|improve this answer
    
but I don't like delete from beginning of line, I like delete from actual cursor position to end of line minus some characters – juanpablo Apr 1 '13 at 15:43
    
@juanpablo my bad. I fixed it. Should work now. – o_o_o-- Apr 1 '13 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .