TIL: Remapping J/K in Vimium to navigate between tabs
In Vim the j and k keys are used to move the
cursor:
jmoves downkmoves up
Together with h (left) and l (right) they form Vim's famous movement
set.
The problem in Vimium
Vimium is a browser extension that lets you
navigate using Vim-inspired shortcuts. To switch between tabs it uses
J and K (uppercase), but by default it ships with a mapping that feels
inverted for anyone used to Vim:
J→ previous tab (previousTab)K→ next tab (nextTab)
Since j in Vim means "go down/forward" and k "go back", it makes more
sense for J to go to the next tab (to the right) and K to the previous one
(to the left).
The remap
In the Vimium options, under Custom key mappings, just add:
map K previousTab
map J nextTab
Now J moves forward to the next tab and K goes back to the previous one,
following the same movement logic as Vim.