Simple vimrc setting to map leader-1 to "switch to tab 1", and so on
I use this when running console vim in tmux and iterm, because the command key is disabled (for cmd+}
) and I don't like to type 3gt
to switch tabs.
add to your vimrc:
" map <leader>1 to tab 1, <leader>2 to tab 2, etc
let i = 1
while i<=8
exec "nnoremap <Leader>".i." ".i."gt"
let i+=1
endwhile
" map leader-9 to the very last tab
nnoremap <leader>9 :tabl<CR>
Written by Ricky Manriquez
Related protips
1 Response
I also added this to map <leader>] and <leader>[ to tab left and right
nnoremap <leader>[ :tabp<CR>
nnoremap <leader>] :tabn<CR>
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#