Skip to content

Instantly share code, notes, and snippets.

@helamonster
Last active August 12, 2019 15:03
Show Gist options
  • Save helamonster/994ffb46849b46f9f049200d3f86cb83 to your computer and use it in GitHub Desktop.
Save helamonster/994ffb46849b46f9f049200d3f86cb83 to your computer and use it in GitHub Desktop.
vim tab movement, etc keybindings
" Tab movement key bindings for vim
" Jeremy Bryan Smith <[email protected]>
" ================ Key Code Settings ================
" Needed by chromeos to map Alt + KEY
set <M-`>=^[`
set <M-1>=^[1
set <M-2>=^[2
set <M-3>=^[3
set <M-4>=^[4
set <M-5>=^[5
set <M-6>=^[6
set <M-7>=^[7
set <M-8>=^[8
set <M-9>=^[9
set <M-0>=^[0
set <M-->=^[-
set <M-=>=^[=
set <M-/>=^[/
" ================ Key Mappings ================
" * Tab movement
" * Alt + 1 ... Alt + 0 : Move to tab 1 ... Move to tab 11
nnoremap <M-1> 1gt
nnoremap <M-2> 2gt
nnoremap <M-3> 3gt
nnoremap <M-4> 4gt
nnoremap <M-5> 5gt
nnoremap <M-6> 6gt
nnoremap <M-7> 7gt
nnoremap <M-8> 8gt
nnoremap <M-9> 9gt
nnoremap <M-0> 10gt
" * F1 ... F10 : Move to tab 11 ... Move to tab 20
" (On chromeos, this is Search + 1 ... Search + 0)
nnoremap <F1> 11gt
nnoremap <F2> 12gt
nnoremap <F3> 13gt
nnoremap <F4> 14gt
nnoremap <F5> 15gt
nnoremap <F6> 16gt
nnoremap <F7> 17gt
nnoremap <F8> 18gt
nnoremap <F9> 19gt
nnoremap <F10> 20gt
" * Alt + ` : Move to last tab
nnoremap <M-`> :tablast<CR>
" * Alt + - : Move to previous tab (wraps around to last tab if on first tab)
nnoremap <M--> :tabprev<CR>
" * Alt + = : Move to next tab (wraps around to first tab if on last tab)
nnoremap <M-=> :tabnext<CR>
" * Toggle highlighting of search text with Alt + /
nnoremap <M-/> :set hlsearch!<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment