How to Use Vim Shortcuts to Navigate Your Web Browser
[ad_1]
While Vim is a text editor designed to be used just by using keyboard shortcuts, browser extensions like Vimium let you navigate the web using similar keybindings without ever touching the mouse. Using Vim shortcuts on your browser can help you get things done faster and more efficiently. In this article, I will show you how to use and configure Vimium on your favorite browser.
Installing Vimium
Install Vimium on Chrome
To install Vimium on Chrome or any other Chromium-based browsers like Brave, go to the Vimium page on Chrome Webstore and select “Add to Chrome.” This will open a pop-up window. Select “Add extension” to add it to Chrome.
Install Vimium on Firefox
You can add Vimium-FF, a Vimium port for Firefox, from the Vimium-FF page on Firefox browser ADD-ONS website.
On the Vimium-FF page, select “Add to Firefox.” Then, on the pop-up window, select “Add” to install it on Firefox.
Install Vimari on Safari
Vimari is a Safari port of Vimium. While Vimari has much limited control compared to Vimium, it handles the basic navigation just fine. You can install Vimari from the App Store.
To enable the Vimari extension on Safari, select “Safari” from the menu bar and go to preferences. Select the “Extensions” tab and check “Vimari.”
Navigating With Vimium
Scrolling with Vimium
Scrolling is probably the most common thing you do on any webpage. With Vimium, you can use J to scroll down and K to scroll up. Pressing H and L lets you horizontally scroll to left and right. To go to the top of the page, press GG. Press Shift + G to go to the bottom of the page as you would do with Vim. You can even scroll down or up half a page by pressing D and U.
Opening a Link
To open a link, press F, which will give a unique label to each of the links for a particular webpage.
To go to a link, type the displayed label on the link. If you want to type something in a text field, just type the label on the text field.
You can press Shift + F to show labels that will open the links on a new page when you type a label.
Manipulating Tabs
To go to the left tab, press Shift + J. Pressing Shift + K will take you to the right tab. If you are using Vimari, press Q and W to go to the left and right tabs. To close the current tab, press X. If you close a tab by mistake, you can restore it by pressing Shift + X (doesn’t work for Vimari).
If you have multiple tabs open, press Shift + T, then search and select the tab to open it.
Navigating Your History
You can go to the previous page on your browser by pressing Shift + H. If you want to back to the page you just came from, press Shift + L.
Getting Out of Insert Mode and Text Fields
Pressing I will get you into insert mode. You can use the regular browser shortcuts in insert mode. For example, if you are on YouTube, pressing M will mute the audio instead of acting as a Vimium shortcut.
Whether you are in insert mode or just in a text field like the search bar, you can get out of it to use Vimium shortcuts again by pressing Esc.
Configuring Vimium
You can configure and change the default Vimium shortcuts to your own preference from the Vimium Options page.
Opening the Vimium Options Page
If you are on Chrome, select the extension icon next to the address bar. Now select the three dots next to the Vimium extension and select “Options” to go to the Vimium Options page.
If you are using Firefox, right-click the Vimium icon next to the address bar and select “Manage Extension.” On the Extensions page, select the three dots next to the Vimium extension and select “Preferences.”
To see all the available commands, select “Show available commands” right next to the “Custom key mappings” box.
This will show the list of available commands and their corresponding keybindings on a pop-up window.
You can modify keybindings for any of these commands.
Mapping and Unmapping a Key in Vimium
To use a certain key for executing a command, enter a map
command in the “Custom key mappings.” The general format is:
map shortcutKey commandName
For example, to use the M key to mute or unmute a tab, enter the command:
If you want to disable a Vimium shortcut, you can use the unmap
command with the shortcut key. For example, if you want to disable Vimimum shortcut /, enter the command:
Select “Save Changes” after entering your commands.
The changes will take place when you visit a new page or reload an already opened page.
Configuring Advanced Options
Vimium has a couple of advanced options like specifying the scroll step size when you press J/K/H/L,which you can tinker with and set to your own preference. If you don’t like smooth scrolling, you can uncheck the use smooth scrolling button from miscellaneous options.
To see the advanced options, select “Show Advanced Options” on the Vimium Options page.
You can also download the configuration file for your current preferences and restore it to use the same shortcuts when you reinstall your browser or choose to use Vimium on a different browser.
To download a backup, select “Click to download backup” from the Backup and Restore menu.
Configuring Vimari
To configure Vimari, select the Vimari icon from the top bar of Safari. This will pop up a new window. On the pop-up window, select “Open Configuration File.”
You will see all the available commands in the bindings section. The keybindings are represented as key-value pairs where the key is the command name for the shortcut and the value is the shortcut key.
If you want to change a shortcut, select the shortcut key after the keyword and replace it with your own shortcut.
For example, if you want to use Shift + J and Shift + K to go to the left and right tabs, replace the lines:
"tabForward": "w", "tabBack": "q",
with
"tabForward": "shift+k", "tabBack": "shift+j",
To disable a shortcut, just leave the value as empty quotes. For example, if you don’t want X to close a tab, replace the line:
with
Press Command + S to save the configuration. This new configuration will now work on the webpages you open or you can just reload an already opened tab on Safari by pressing R to use the new configuration.
Frequently Asked Questions
Is Vimium/Vimari secure?
Yes. Vimium/Vimari doesn’t talk to any server and stores all your preferences locally.
Why doesn’t Vimium/Vimari work on the browser’s homepage?
Vimium and Vimari don’t work on some pages like the Chrome homepage, Chrome Webstore, and Safari homepage as per the browsers’ policy.
What happens if a website has the same shortcut as Vimium’s?
In normal mode, Vimium shortcuts will get priority. However, you can use a website’s regular shortcuts in insert mode.
Image credit: Colorful keyboards by 123FR. Screenshots by Muhammad Munna
Is this article useful?
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
[ad_2]
Source link