Skip to content

Instantly share code, notes, and snippets.

@nastysloper
Created March 25, 2015 14:15
Show Gist options
  • Save nastysloper/d2e4061682790a7329f1 to your computer and use it in GitHub Desktop.
Save nastysloper/d2e4061682790a7329f1 to your computer and use it in GitHub Desktop.
Move lines in vim

This vim type courtesy of http://vi.stackexchange.com/questions/2674/how-can-i-easily-move-a-line

For the longest time I'd visually select a range and then do d or x and then p to move lines. Instead, you can simply type

:move +1 :move -2 // move specified line up one line

:[range]m[ove] {address} :m :mo :move

move the lines given by [range] to below the line given by {address}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment