Vimium for Google Chrome

Jun Choi
6 min readFeb 2, 2021

For people who want to browse the web without using the mouse, I strongly recommend getting Vimium for Google Chrome or Firefox. If you are thinking about changing from full-sized or 80% (ten keyless) keyboard to 60% or 40% keyboard, I also recommend getting Vimium or a similar extension since you’ll be operating with less keys. I’ve been using Vimium extension since May 4th, 2020, and it drastically improved my web browsing experience.

Vimium provides keyboard shortcuts for navigation and control in the spirit of Vim. You can install Vimium for Google Chrome here.

There are other extensions similar to Vimium like cVim and Surfingkeys. However, after trying out all of them, I found Vimium to be the best option for the reason below.

cVim’s f key, which is my most used key that opens a link in the current tab, did not properly work on Google Chrome. Also Surfingkeys’ f key sometimes did not detect certain elements on some websites. For this reason alone, I decided to go with Vimium.

Most of information below can be found on Vimium’s github wiki, but I’ve added some info that were not in the official wiki page and will be going over some features more thoroughly.

Basic keyboard shortcuts on Vimium

Navigating the current page:

?       show the help dialog for a list of all available keys
h scroll left
j scroll down
k scroll up
l scroll right
gg scroll to top of the page
G scroll to bottom of the page
d scroll down half a page
u scroll up half a page
f open a link in the current tab
F open a link in a new tab
r reload
gs view source
i enter insert mode
yy copy the current url to the clipboard
yf copy a link url to the clipboard
gf cycle forward to the next frame
gF focus the main/top frame

Navigating to new pages:

o       Open URL, bookmark, or history entry
O Open URL, bookmark, history entry in a new tab
b Open bookmark
B Open bookmark in a new tab

Using find:

/       enter find mode (equivalent to CTRL-F on Google Chrome)
n cycle forward to the next find match
N cycle backward to the previous find match

Navigating your history:

H       go back in history
L go forward in history

Manipulating tabs:

J, gT   go one tab left
K, gt go one tab right
g0 go to the first tab
g$ go to the last tab
^ visit the previously-visited tab
t create tab
yt duplicate current tab
x close current tab
X restore closed tab (i.e. unwind the 'x' command)
T search through your open tabs
W move current tab to new window
<a-p> pin/unpin current tab

Using marks:

ma, mA  set local mark "a" (global mark "A")
`a, `A jump to local mark "a" (global mark "A")
`` jump back to the position before the previous jump

Additional advanced browsing commands:

]], [[  Follow the link labeled 'next' or '>' ('previous' or '<')
<a-f> open multiple links in a new tab
gi focus the first (or n-th) text input box on the page
gu go up one level in the URL hierarchy
gU go up to root of the URL hierarchy
ge edit the current URL
gE edit the current URL and open in a new tab
zH scroll all the way left
zL scroll all the way right
v enter visual mode; use p/P to paste-and-go, use y to yank
V enter visual line mode

Additional Information

Many Vimium commands accept count prefix.

Examples:

  1. All scrolling commands like j & k. 2j and holding j would scroll down twice as fast while smooth scrolling is enabled.
  2. Commands that open new tabs or windows like t & W. 2yt would open two new current tabs to the right of current tab.
  3. H & L

Custom key mappings

If you wish to assign custom key mappings, you can do so on Vimium’s options under “Custom key mappings”.

Custom key commands:

map key       Command Maps a key to a Vimium command.
unmap key Unmaps a key.
unmapAll Unmaps all bindings.

unmapAll is useful if you want to completely wipe Vimium’s defaults and start from scratch with your own setup.

Special keys:

<c-*>, <a-*>, <m-*> for ctrl, alt, and meta (command on Mac)
<left>, <right>, <up>, <down> for the arrow keys.
<f1> through <f12> for the function keys.
<space> for the space key.
<tab>, <enter>, <delete>, <backspace>, <insert>, <home> and <end>

* can be replaced with any key.

<c-p> means pressing control and p.

Disabling Vimium

Partially disabling Vimium

In this case, Vimium is enabled as normal, except for the three listed keys and question mark. These are passed through to the underlying page. Here, we’re using Gmail’s native j, k, and n bindings and ? for Gmail’s native help screen. All other Vimium keys are handled by Vimium, as usual.

Completely disabling Vimium

In this case, Vimium is completely disabled since the list of excluded keys is empty.

Temporarily disabling Vimium

In insert mode, all Vimium bindings are temporarily disabled, and all keystrokes (except <Escape>) are passed through to the underlying page. Enter insert mode with i, and leave insert mode with Escape.

Personally, I enable Vimium on every website and enter insert mode to use the webpage’s native or another extension’s shortcut keys (for example: shortcuts for Reddit Enhancement Suite, Gmail, Jupyter Notebook, Youtube, etc). It’s worth noting that when you have both Reddit Enhancement Suite extension and Vimium extension installed, Vimium takes over Reddit Enhancement Suite shortcuts by default, and you have to use insert mode to use Reddit Enhancement Suite’s shortcuts.

passNextKey

Vimium uses the <Escape> key to exit insert mode. Some websites use the <Escape> key to perform actions (like closing a window) from within inputs. For such websites, Vimium effectively blocks the site’s own functionality. One example of this is the Messenger popups used by Facebook.

The passNextkey command solves this problem.

map <c-]> passNextKey

Now, <c-]><Escape> passes the <Escape> key to the web page itself. If you’re on Facebook, this closes the Messenger popup.

Another example would be if you want to use Youtube’s fullscreen shortcut f without going into insert mode since entering insert mode creates a notification box (to indicate you’re on insert mode) on the bottom right corner of the screen. You would enter <c-]> f to full-screen Youtube video without going into insert mode.

Visual mode & carat mode

Visual mode is used for selecting text on the page and caret mode is used for changing the starting point for selecting text on the page.

Personally, I do not find carat c mode to be all that useful since I can just use Vimium’s find function / or Chrome’s native find function CTRL-F to select the starting text position.

However, I do find Vimium’s visual mode v and visual line mode V to be quite useful since I can implement number of vim-like movements after selecting starting text position. For example: j, k, h, l, w, e, b, etc. Counts are also supported, for example, 3e.

Exiting visual mode:

esc    exit visual mode
y yank the selected text to the clipboard
p/P send the selected text to the default search engine in
current tab/new tab

Scrolling in visual mode:

<c-y>    scroll up
<c-e> scroll down

Personal Comments about Vimium

I’ve been using Vimium and native Chrome shortcuts together. If there’s a shortcut that is supported by Google Chrome, I tend to use Chrome’s native shortcut version over Vimium’s.

For example:

  • I still use native Chrome shortcuts to switch tabs (CTRL-NUM & CTRL-PAGEUP/PAGEDOWN) but I also started to use Vimium’s J and K to switch tabs.
  • I use Chrome’s native shortcut CTRL-SHIFT-N to open a new incognito tab, and I have not made a custom key for opening a new incognito tab in Vimium.

Overall, I recommend Vimium to anyone who wants to improve web-browsing experience and doesn’t mind putting some time into learning new shortcuts.

--

--