Created
January 11, 2012 15:26
-
-
Save joechrysler/1595171 to your computer and use it in GitHub Desktop.
Move lines of code around using vim's directional keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Pop the following into your .vimrc | |
" Move a line of text using CTRL+[arrows] | |
nmap <C-down> mz:m+<cr>`z | |
nmap <C-up> mz:m-2<cr>`z | |
nmap <C-left> << | |
nmap <C-right> >> | |
vmap <C-down> :m'>+<cr>`<my`>mzgv`yo`z | |
vmap <C-right> :m'<-2<cr>`>my`<mzgv`yo`z | |
"" Move around split windows with CTRL+[jkhl] | |
map <C-j> <C-W>j | |
map <C-k> <C-W>k | |
map <C-h> <C-W>h | |
map <C-l> <C-W>l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment