Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.