Skip to content

Instantly share code, notes, and snippets.

@nicklasos
Created September 11, 2012 21:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicklasos/3702393 to your computer and use it in GitHub Desktop.
Save nicklasos/3702393 to your computer and use it in GitHub Desktop.
Moving lines up or down
nnoremap <C-k> mz:m-2<CR>`z==
inoremap <C-j> <Esc>:m+<CR>==gi
inoremap <C-k> <Esc>:m-2<CR>==gi
vnoremap <C-j> :m'>+<CR>gv=`<my`>mzgv`yo`z
nnoremap <C-j> mz:m+<CR>`z==
vnoremap <C-k> :m'<-2<CR>gv=`>my`<mzgv`yo`z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment