Mapping firefox keyboard shortcut with vimperator to select a tab
I’ve started to use the Firefox add-on Vimperator. It enables Firefox to behave more like Vim. I installed this add-on, not because I know Vim so well, but because I really like the ability to use my browser with a keyboard.
One of the things I really missed after installing Vimperator was the ability to select an open tab directly by a keyboard shortcut. I’ve used the following mapping (a well known method to vim users) to fix this and now I can select an open tab directly.
:map <C-1> :tabn1<CR>
In the snippet above I created the shortcut CONTROL-1 which selects tab number 1 following with ENTER. I would like to use a variable in the mapping but I have not been able to find out how to achieve this, so for now just add more mappings with following numbers, e.g. replace 1 for 2 etc. If you know how to add variables in vimperator let me know!
If you don’t see the numbers in your tabs or don’t see tabs at all you’ll need to enable the gui, you can use the following snippet:
:set go+=mTBn<CR>
This shows the following gui parts:
- m Menubar
- T Toolbar
- B Bookmark bar
- n Tab number
Now you should see the gui including the numbers in the opened tabs.
NB: Don’t forget to save the settings with the following:
:mkv<CR>
if you’re already have a saved configuration then you need to add a exclamation mark to the above.
:mkv!<CR>
