For example, I want to map the key stroke <Fixed key><Number>
to :tabn <Number><CR>
. I don't normally use more than 8-9 open tabs and so this will be helpful for quickly switching between tabs. How do I set the mapping to accept any entry in <Number>
? Of course, since there are only 9 possible options, I can simply write it out for each one, but I wanted to know if there's a smarter way of doing this.
Your question is nice, but you can already use <number>gt
for that. And I am afraid there is no way to have argument-dependent mapping. However you could do a loop in vimscript that generates your mapping commands.
Edit: otherwise you can put that in your vimrc:
let i = 1
while i <= 9
execute 'nnoremap <fixed_key>' . i . ' ' . i . 'gt'
let i = i + 1
endwhile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With