开发者

Delete n lines in the up direction in vim

Is there a command in vim which will delete n lines in the up direction.

I know I can use 4dd开发者_运维问答 which will delete 4 lines downwards.


In VIM, 3dk would delete 4 lines in the upward direction. Further documentation can be found at http://www.vim.org/docs.php


V3kd would do it.

Thats "V" to enter visual line select mode, "3k" to move up 3 lines, and then "d" to delete the 4 lines you have selected.


You can do it with a backwards range.

:-4,.d

Deletes from minus 4 lines to current. But this is an ex mode command.


  1. Position the cursor where you want to begin cutting.
  2. Press v (or upper case V if you want to cut whole lines).
  3. Move the cursor to the end of what you want to cut.
  4. Press d.
  5. Move to where you would like to paste.
  6. Press P to paste before the cursor, or p to paste after.

http://vim.wikia.com/wiki/Copy,_cut_and_paste


  1. stand at the end of the last line
  2. hold Backspace and wait until the last character of the first line is deleted
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜