Who needs Mouse? We can navigate the Internet just using your Keyboard, without touching the mouse or touchpad. Yes, there is a Google Chrome extension called Vimium which helps you to browse the web with Vim Keybindings. Vimium, also known as the Hacker's Browser, provides a bunch of keyboard shortcuts for navigation and control of the web in the spirit of the Vim editor. Good thing is Vimium will not change or modify the browser's interface in any way. It simply allows a user to navigate web pages, tabs and links using vim-like keyboard commands. If you are familiar with the Vim keybindings already, you can efficiently browse the Web as the way you use Vim editor. Vimium is a free, open source project and its code is freely available in GitHub.
Vimium let us do all sort of actions as listed below:
- Scroll through a web page,
- Reload a page,
- Select a link,
- Open a link in current/new/background tabs,
- Switch to next/previous tabs,
- Restore a closed tab,
- Pin/unpin current tab,
- Go back and forth,
- Move down/up and left/right,
- Move to half page down and up,
- Copy an URL to clipboard,
- Bookmark a page,
- Search bookmarks and history,
- View page source and a lot more.
All from the keyboard! No mouse is actually required!!
Vimium is mainly developed for Google Chrome, however there is an experimental port of Vimium on Firefox available here. Unfortunately, some functions may not work in the Firefox version.
Vimium should work on all OSes that supports Google Chrome, Chromium and any Web browsers which are based on Chrome web browser. Install Vimium from the Chrome Extensions Gallery.
After adding the Vimium extension, you will see the icon in your browser's tool bar.
Well, Vimium extension is activated. Let us see how to navigate the web using keyboard shortcuts.
Browse the web with Vim Keybindings using Vimium
As I already mentioned, if you are used to the Vim keyboard shortcuts, you won't find any difficulties to browse the web just using your Keyboard.
Open any web page in Chrome/Chromium browser.
Press j and k to scroll down and up throughout the web page.
To scroll half page down, press d. Similarly, to scroll half page up, press u. i.e. d for down and u for up.
You can scroll to a top of a web page immediately by pressing gg. Similarly, to scroll to the bottom of a page, press SHIFT+g.
What if I want to scroll left or right instead of up/down? That's easy! Press h to scroll left and l to scroll right. This is useful while reading long landscape pages.
To open any link in a web page, press SHIFT+f. After pressing SHIFT+f, you will see some random letters next to each links as shown in the below screenshot.
Just press those letters to open the respective links in the new tab. For example, when I typed the letter 'h' , it opened the first link (i.e. Manually Add Messages To Linux system Log Files) in a new background tab from the above page.
To change between from one tab to another tab, press SHIFT+j or SHIFT+k. To go back and forward, press SHIFT+h and SHIFT+l.
You can reload the current tab by pressing r.
For some reason, you might want to copy an URL to the clipboard. If so, press yy to copy the current URL to clipboard. The clipboard's URL can be opened by pressing p to open it in current tab or SHIFT+p to open it in a new tab.
How would you input texts on a form in a web page? For instance, you may want to fill a contact form in a web page. If so, press gi to focus the first text input filed. Type the inputs and press tab to go to the subsequent input fields.
To close the current tab, press x. And to restore the currently closed tab, press SHIFT+x.
Search bookmarks and browsing history
We can open the entries from bookmarks and browsing history by typing the letter o (o for Olympics).
Use up/down arrow keys to go through the history list.
If you have already opened multiple tabs, press SHIFT+t to search through all of the opened tabs.
You don't even have to remember all the keybindings. Just press ? (question mark) to open up the help menu at any time. The Vimium help section includes all available shortcuts along with description.
I created a simple one-page image template that contains all Vimium shortcuts. Print this image and put it on your table or any visible place.
Create custom shortcuts
There is also a way to create custom keyboard shortcuts. If you want to map a key to do a particular action, here is how you can do it.
Open help menu by pressing the ? key. Click on the Options button on the top.
In the Custom key mappings column, set your keybindings in the following format.
map <key> <command>
map c removeTab
The above command will map the key c to close the current tab.
You can find the command that closes the current tab from Show available commands link.
Here is the command to close the current tab.
Just copy/paste it in the Custom key mappings column and click Save changes to take effect the changes.
Now you can close the current tab by pressing c.
This is just enough to browse the Web without a mouse. There are a few more additional advanced shortcuts available. Refer the project's GitHub repository given at the end for more details.
Other useful Vim resources:
- PacVim – A CLI Game To Learn Vim Commands
- How To Use Vim Editor To Input Text Anywhere
- How To Comment Out Multiple Lines At Once In Vim Editor
- How To Manage Vim Plugins Using Vundle On Linux
- Vim-plug : A Minimalist Vim Plugin Manager
- How To Use Spell Check Feature In Vim Text Editor
- How To Edit Multiple Files Using Vim Editor