Last active
October 4, 2017 02:05
-
-
Save suewonjp/b94df51a4bd6d0333f657c6869dd3180 to your computer and use it in GitHub Desktop.
[vim tip] key mappings for conveniently traversing windows and tabs
This file contains 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
" These mappings are based on the default key movement scheme of Vim (h, j, k, l) | |
" For example, when you want to move to the left tab, press Alt + h | |
" When you want to move to the window underneath, press Shift + Alt + j | |
" Paste the below code to your Vim settings file ( ~/.vimrc ) | |
" Map Alt(Meta) key combinations | |
execute "set <M-l>=\el" | |
execute "set <M-h>=\eh" | |
execute "set <M-L>=\eL" | |
execute "set <M-H>=\eH" | |
execute "set <M-J>=\eJ" | |
execute "set <M-K>=\eK" | |
" Move to next tab page | |
nnoremap <M-l> gt | |
" Move to previous tab page | |
nnoremap <M-h> gT | |
" Move to upper window | |
nnoremap <M-K> <C-w><C-k> | |
" Move to lower window | |
nnoremap <M-J> <C-w><C-j> | |
" Move to left window | |
nnoremap <M-H> <C-w><C-h> | |
" Move to right window | |
nnoremap <M-L> <C-w><C-l> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've written a vim plugin called Vim-Jumparound including the code above and other goodies. Consider using it.
https://github.com/suewonjp/vim-jumparound