Stephen Whitmore

A Brief Guide to vimb: the vim-like web browser

2016-12-26 20:31:45

What is vimb?

Vimb is a fast and lightweight vim like web browser based on the webkit web browser engine and the GTK toolkit.” - https://fanglingsu.github.io/vimb/

vimb screenshot

To understand vimb, you will first benefit from knowing of vim: a highly configurable text editor. It’s unique in that it is one of the oldest text editors still in active use today: in fact, vim just turned 25 years old this year!

vim makes for efficient text editing due to its focus on most operations being accessible from the home row of your keyboard. You can operate vim entirely without a mouse.

vimb takes these attractive properties and extends them to the web: a lightweight browser that can be operated using the keyboard alone, that is highly configurable. A lofty goal!

Getting started

Installation

vimb plays best with Linux. Odds are, vimb can be found via your package manager.

If you are running Windows or macOS, then you’ll have to go down the less traveled road of building vimb from its source code.

Orientation

When you run vimb for the first time, you’ll find yourself on the vimb website. Hit ‘f’ to bring up link hints, and type the letter beside the ‘man’ heading along the top. This will bring up the program manual. It’s a bit dense, but worth skimming to get an idea of what key bindings are available out of the box.

vimb lets you follow links by showing link hints when you press certain keys. The default is ‘f’ (for “follow”). It makes the screen look like this:

vimb follow mode

Here are some of the keys you’ll find yourself using the most:

vimb has great tab completion. Hit o and type in a substring of the url of any website you’ve visited, hit TAB, and you’ll get a list to choose from. It even matches website titles!

These should be enough pieces for everyday navigation, but do peruse the manual for even more.

Configuration

On Linux, vimb looks in ~/.config/vimb/config for configuration information. Here are some tidbits from my setup that you might find helpful for tailoring vimb to your needs:

# Makes the last 30k websites you visited searchable.
set history-max-items=30000

# Choose your own keys for hint titles. I try to stick to the home row.
set hintkeys=jklfds;a123467890

# Rebind Back and Forward to something more convenient.
nnoremap H <C-O>
nnoremap L <C-I>

# I find just tapping 'qq' easier than :q<ENTER>.
nnoremap qq :q<CR>

# Tweak font sizes as per your preferences.
set fontsize=10
set monofontsize=9
set minimumfontsize=7

# I like browsing with Javascript turned off by default. However, if a website
# needs it, can I just hit ! and have the page reload with JS activated.
set scripts=off
nnoremap ! :set scripts!<CR>r

Search engines

vimb lets you configure various search engines, which is more generally a facility for what it calls “shortcuts”.

For example, if I had a line like the following in my ~/.config/vimb/config:

shortcut-add d=https://duckduckgo.com/?q=$0

I could then type o d nodejs<ENTER> in vimb to perform a DuckDuckGo search for “nodejs”. It’s easy to add others!

" Google
shortcut-add g=https://encrypted.google.com/search?hl=en&q=$0

" NodeJS modules
shortcut-add n=http://node-modules.com/search?q=$0

" Arch Linux wiki
shortcut-add a=https://wiki.archlinux.org/index.php?title=Special%%3ASearch&search=$0&go=Go

If you end up using vimb with Javascript turned off by default as well, DuckDuckGo has a super fast HTML-only version of their site. Add it to your configuration:

shortcut-add d=https://duckduckgo.com/html?q=$0

Where are the tabs!?

vimb tries to embrace the UNIX Philosophy of single programs that do one thing well.

The developers decided that this means not including any tab management by default. Each “tab” command, like t http://blog.eight45.net will, you may have noticed, open a brand new vimb window.

This takes some getting used to. The behaviour isn’t “bad” perse, just different than a pattern that the majority of web browsers employ. I’ve noticed that this frustrates some people.

You have a couple of options. The official approach is to use a separate program to manage tabs. vimb supports the XEmbed protocol, meaning you can use a separate program like tabbed to manage tabs within a wrapping parent window. Once tabbed is installed, run vimb as tabbed -c vimb -e. You can find more information in the vimb FAQ

Another approach, which is the one I use, is to embrace the one-window-per-tab philosophy and make use of a tiling window manager to keep track of your windows. I often use i3’s “tabbed layout”, which lays out my vimb windows in in tabs not unlike traditional browsers, except with the added benefit that each tab is its own separate process that can be managed, killed, or suspended.

Passthrough mode

Web apps that require a high amounts of mouse interactions, such as map viewer websites, will not work quite right out of the box. Fortunately, pressing CTRL+Z puts vimb into PASSTHROUGH mode, which deactivates all of vimb’s vim key bindings and makes it operate much like a traditional web browser.

You can hit Escape at any time to return to Normal mode.

Who is vimb for?

I’ve been using vimb as my default web browser for the last four months, with no intention of turning back. I’ve gotten by swimmingly: it’s a joy to use, and is configured in a way that would be difficult using a traditional browser like Chrome or Firefox.

vimb is for you if you like…

  1. …a more lightweight web browser, that eats up less memory and cpu cycles and loads pages faster.
  2. …idea of foregoing the mouse when browsing the web.
  3. …being able to configure just about any aspect of how your web browser works.

Who is vimb not for?

vimb might not be for you if you rely on…

  1. …cutting edge web features, like WebGL or WebRTC. Common for most web games, or video/voice calling apps.
  2. …the Flash or Silverlight plugins. Common for watching videos on Amazon or Netflix.

Since I do occassionally require some of the above from time to time, I’ve found it useful to keep Chrome or Firefox around for certain websites.

For YouTube and other video sites, I use youtube-dl to download videos locally and watch them with mplayer. (Though I hear you-get is an exciting up-and-coming youtube-dl contender!)

Try it out!

Give vimb a try! Even if vim isn’t your editor of choice, using a keyboard-driven web browser is a unique and interesting experience that ought to broaden your horizons about what exactly a web browser is.

How’d it go? Get stuck along the way? Let me know how it went.