Move entire line up and down in Vim

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

    When you hit command :help move in vim, here is the result:

    :[range]m[ove] {address} *:m* *:mo* *:move* *E134* Move the lines given by [range] to below the line given by {address}.

    E.g: Move current line one line down => :m+1.

    E.g: Move line with number 100 below the line with number 80 => :100 m 80.

    E.g: Move line with number 100 below the line with number 200 => :100 m 200.

    E.g: Move lines with number within [100, 120] below the line with number 200 => :100,120 m 200.

提交回复
热议问题