Tmux style tab switching in Vim

57 Views Asked by At

I am looking for a way to map number keys to :tabnext in VimL. I want to make it easier when switching tabs and enable tmux style switching.

map <leader>t[0-9] :tabnext regex([0-9])

This is my working solution but I not sure if there is any facility for regex in Vim. Is it possible to map a range of keys, to a regular expression?

1

There are 1 best solutions below

0
dNitro On

Use a for loop to achieve this. Add to your .vimrc :

for i in range(9)
  execute printf('nnoremap <silent> <leader>t%d :tabnext %d<CR>', i, i)
endfor