Delete n lines in the up direction in vim

前端 未结 5 2013
旧时难觅i
旧时难觅i 2021-02-01 12:41

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.

相关标签:
5条回答
  • 2021-02-01 13:07

    You can do it with a backwards range.

    :-4,.d
    

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

    0 讨论(0)
  • 2021-02-01 13:12

    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.

    0 讨论(0)
  • 2021-02-01 13:15
    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 讨论(0)
  • 2021-02-01 13:22
    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

    0 讨论(0)
  • 2021-02-01 13:23

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

    0 讨论(0)
提交回复
热议问题