Move entire line up and down in Vim

后端 未结 19 1144
无人及你
无人及你 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

    add the following to ~/.vimrc file (make sure you have no mapping for n,m )

    nmap n :m +1
    nmap m :m -2
    

    now pressing n key will move a line down and m will move a line up.

提交回复
热议问题