My name is Jeaye

I'm a leader, a problem solver, and a hacker with a passion for privacy and security.

Vimb on Slackware

The popular vim text editor is known for its modal editing, intricate key sequences, and powerful capabilities and extensibility. Vim-style editing and navigation is incorporated deeply into my computing experience, covering:

  1. (Of course) My text editing (gvim, vim)
  2. My music playing (cmus)
  3. My relay chatting (weechat)
  4. My shell (bash -o vi)
  5. My PDF viewer (zathura)
  6. My email viewer (mutt)
  7. My window manager (i3)
  8. My torrent client (rtorrent)
  9. My web browser (firefox with vimfx)
  10. My volume manager, pager, network manager, etc

My point should be clear. Still, I’m always on the lookout for new ways I can improve my vim-style interactions with various programs. As firefox is my main browser, I’ve, of course, tried pentadactyl, vimperator, vimprobable before landing with vimfx.

Recently, I stumbled across vimb which is a webkit-based browser designed from the bottom up to work like vim. A possible benefit of this is that vimb is a standalone browser, not just a firefox plugin; this means there’s none of the firefox bloat around. It also means, however, that other firefox plugins and features won’t be available.

Installation

Since I’m running Slackware, I built vimb from source. This wasn’t much of an issue, once the dependencies were sorted out. The key dependency for compilation was webkitgtk3. You can actually use webkitgtk2, if you’d like, but I’m not sure why that’d be more desirable, since you’d need to get that from SBo just the same. See my post on sbopkg for more info on building packages from SBo.

NOTE 1: webkitgtk3 exposes a bug in GNU Make which requires it to be built with -j1. Combined with it being a huge library, you can expect compilation to take several hours on a modern machine.

NOTE 2: The webkitgtk3 build system requires that /usr/bin/cc exists; if your compiler is custom and installed locally, I’ve found a temporary symbolic link does the trick.

With webkitgtk3 installed, building and installing vimb is as simple as:

$ make GTK=3
$ make install

Configuration

Compile-time

You can customize various options, as well as compiler flags by editing config.mk in the repository’s root directory. Since I’m installing locally and I found there were no optimizations enabled by default, this is a diff of what I supplied:

diff --git a/config.mk b/config.mk
index 79167b7..3163adc 100644
--- a/config.mk
+++ b/config.mk
@@ -2,7 +2,7 @@
 VERSION = 2.9

 PROJECT     = vimb
-PREFIX     ?= /usr/local
+PREFIX     ?= ~/opt/bin/vimb
 BINDIR     ?= $(PREFIX)/bin
 MANDIR     ?= $(PREFIX)/share/man
 EXAMPLEDIR ?= $(PREFIX)/share/$(PROJECT)/examples
@@ -50,6 +50,7 @@ CFLAGS  += -Wall -pipe -std=c99
 CFLAGS  += -Wno-overlength-strings -Werror=format-security
 # This is to avoid redifinition warnings caused by glib.
 CFLAGS  += -Wno-typedef-redefinition
+CFLAGS  += -O3
 CFLAGS  += ${CPPFLAGS}
 LDFLAGS += ${LIBFLAGS}

You’ll need to recompile, of course, after changing anything in config.mk.

Run-time

The runtime configuration, for me, defaulted to ~/.config/vimb. There are a dozen or so files in there, by default, and I only bothered modifying a couple: config and style.css.

HTML5 Video Support

I ran quite a bit of trouble getting HTML5 video (from YouTube, for example) working. Ultimately, I needed these packages:

$ ls -1 /var/log/packages/gst*
/var/log/packages/gst1-libav-1.4.5-x86_64-1_SBo
/var/log/packages/gst1-plugins-bad-1.4.5-x86_64-1_SBo
/var/log/packages/gst1-plugins-base-1.4.5-x86_64-1_SBo
/var/log/packages/gst1-plugins-good-1.4.5-x86_64-1_SBo
/var/log/packages/gst1-plugins-ugly-1.4.5-x86_64-1_SBo
/var/log/packages/gst-ffmpeg-0.10.13-x86_64-2_SBo
/var/log/packages/gst-plugins-bad-0.10.23-x86_64-3_SBo
/var/log/packages/gst-plugins-base-0.10.36-x86_64-2
/var/log/packages/gst-plugins-good-0.10.31-x86_64-5
/var/log/packages/gst-plugins-ugly-0.10.19-x86_64-2_SBo
/var/log/packages/gstreamer-0.10.36-x86_64-2
/var/log/packages/gstreamer1-1.4.5-x86_64-1_SBo

I’ve covered this in a vimb issue here.

Comparing Functionality From Firefox

In Firefox, I have a few features which I really enjoy:

  1. Pinned tabs (no vimb support – no tabbing support at all)
  2. Vim-style navigation (obvious vimb support)
  3. Color schemes (vimb support through style.css)
  4. Adblock (no vimb support – people suggest using privoxy)

Pinned Tabs

At first, I wrote a script to do this for me. If I open vimb and no other instances are open, open my stored “pinned” tabs. I found it’s annoying to get right, since vimb doesn’t support tabbing and that’s being handled by my window manager. Alas, the windows don’t get opened in the order I’d like. I ultimately ditched the script and just started using vimb’s bookmark support more judiciously.

Vim-style Navigation

The navigation, as well as the command mode, is superb. I was able to configure everything just as I wanted and it felt very native.

Color schemes

After a bit of searching, I found that a custom style.css can be placed in ~/.config/vimb which can replace the CSS of any webpage. After some tinkering, I cooked up a solarized dark style using the following:

*,div,pre,textarea,body,input,td,tr,p
{
  background-color: #002b36 !important;
  background-image: none !important;
  color: #657b83 !important;
}

h1,h2,h3,h4
{
  background-color: #002b36 !important;
  color: #5f676a !important;
}

a
{
  color: #859900 !important;
}

a:hover,a:focus
{
  color: #859900 !important;
}

a:visited
{
  color: #b58900 !important;
}

img
{
  opacity: .5;
}

img:hover
{
  opacity: 1;
}

._hintLabel
{
  text-transform: uppercase !important;
  background-color: #cb4b16 !important;
  font-size: 1.0em !important;
  color: #000 !important;
  opacity: 1.0 !important;
}

._hintElem._hintFocus
{
  color: #f0f070 !important;
}

._hintElem._hintFocus img
{
  opacity: 1;
}

Adblock

Unfortunately, there’s no adblock in vimb. In fact, vimb itself doesn’t actually have plugin support, ironically. There was a post on the vimb mailing list which ultimately ended in vimb users claiming to have privoxy setup locally. I have experience with privoxy, but I haven’t bothered setting it up for vimb.

Other Thoughts

I have some other gripes with vimb which don’t fall into the above categories:

  1. It’s noticeably slower to load web pages than firefox
  2. It flickers quite frequently, even after a page has finished loading
  3. I see a fair amount of crashes, typically half a dozen per day
  4. It often says that I have no internet connection when I do
  5. There are some bugs relating to entering insert mode in an input box using the mouse
  6. Quite randomly, it will get stuck using 100% CPU (on no particular page) and needs to be closed

I love the idea of vimb; a slick, thin browser that envelops itself in the vim ideals and doesn’t have all the fluff you get in something like firefox or chrome. Unfortunately, it’s not yet usable enough for me.

My Configuration

The contents of my ~/.config/vimb/config:

# Home
set home-page=http://github.com

# Downloads
set download-path=~/downloads

# UI
set hintkeys=asdfglkjh
set stylesheet=on
set smooth-scrolling=on

# Status bar
set statusbar=false
set status-color-bg=#002b36
set status-color-fg=#657b83
set status-font=terminus\ 15
set status-ssl-color-bg=#002b36
set status-ssl-color-fg=#657b83
set status-ssl-font=terminus\ 15
set status-sslinvalid-color-bg=#002b36
set status-sslinvalid-color-fg=#657b83
set status-sslinvalid-font=terminus\ 15

# Input bar
set input-bg-normal=#002b36
set input-fg-normal=#657b83
set input-font-normal=terminus\ 15
set input-bg-error=#002b36
set input-fg-error=#5f676a
set input-font-error=terminus\ 15

# Completion
set completion-bg-normal=#002b36
set completion-fg-normal=#657b83
set completion-bg-active=#002b36
set completion-fg-active=#5f676a
set completion-font=terminus\ 15

# Webkit
set accelerated-compositing=on
set defaultencoding=utf-8
set html5-database=on
set html5-local-storage=on
set images=on
set webgl=on

# SSL
set strict-ssl=false

# JS
set javascript-can-access-clipboard=off
set javascript-can-open-windows-automatically=off

# Editing
set editor-command=gvim -f %s

# Zoom in everything by default
aug zoom_all
  au LoadCommited * normal zz|8zI
aug end

# Try to speed things up
set proxy=off