Move entire line up and down in Vim

后端 未结 19 1141
无人及你
无人及你 2020-11-29 14:27

In Notepad++, I can use Ctrl + Shift + Up / Down to move the current line up and down. Is there a similar command to this in Vim?

19条回答
  •  鱼传尺愫
    2020-11-29 15:07

    In command mode position the cursor on the line you want to move down, and then

    ddp
    

    Explanation: dd deletes the current line to the general buffer p puts it back AFTER the cursor position, or in case of entire lines, one line below.

    There is some confusion regarding commands p and P in many docs. In reality p pastes AFTER cursor, and P AT cursor.

提交回复
热议问题