Quickly move lines up and down in any Vim mode

I often move lines around in vim so I have created mappings to make this easier. These map to ⌘-j for move down and ⌘-k for move up. Works in normal, insert, and visual modes. vim nnoremap :m .+1== nnoremap :m .-2== inoremap :m .+1==gi inoremap :m .-2==gi vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv I use MacVim so I have used D(⌘) for the modifier key. To use in terminal based vims, use a different modifier e.g.

1.07 Thousand
Joe

Get our stories delivered

From us to your inbox weekly.