Firefox 4 and Vimperator 3

Posted Thu 27 January 2011 19:04 under category tech

firefox

I've been using Google Chrome's dev channel for the past year or so as my primary browser, but between some questionable aesthetic decisions and Chrome's tendency to segfault every hour or so for the last few dev releases, I decided that it's time to give up on the faster browser in exchange for the usable browser. Toward that end, I'm going back to Firefox. I hear that Firefox 4 is the next cool thing, so I set it up on my work machine (4.0b10pre, if you're interested). And, of course, since I am both a die-hard vim user and a big fan of the keyboard, I've gone back to my old friend vimperator.

I had used vimperator with Firefox 4 briefly a couple of months ago, but found it to be most unsatisfactory. I am happy to report that they have resolved all of the concerns I had with the version 3 alphas, and it's now way better than 2.x was under Firefox 3. Of course, their Design Goals for v3 are really scary and seem like they'd neuter the project in the name of making it more “friendly”. Bu, for now, it's pretty awesome. That said, it's not perfect out of the box, so I've been working on a nice ~/.vimperatorrc. You can find the latest version at this dropbox URL, but I thought I'd post an annotated version inline as well.

set act=addons,downloads,extoptions,help,quickmark
set cpt=slt
set go=br
set hlsearch
set stal=2

autocmd LocationChange .* js modes.passAllKeys = /mail\.google\.com/.test(buffer.URL)
autocmd LocationChange mail\\.google\\.com :set editor="gvim -f -c 'set ft=mail'"

command! -nargs=? -description="Pin the given tab" pin javascript config.tabbrowser.pinTab(tabs.getTab(<args>))
command! -nargs=? -description="Unpin the given tab" unpin javascript config.tabbrowser.unpinTab(tabs.getTab(<args>))
nmap gp :pin
nmap gu :unpin

The first block sets up some useful parameters: it disables auto-focusing new tabs, it disables completion of local filenames (which is still dog-slow under Firefox 4), it disables the bulky, ugly toolbar, it turns on search highlighting, and it forces the tab-bar to always be shown.

The middle block ensures that I can still use keyboard shortcuts on Gmail, and that the file-type is set correctly when editing mail in an external editor from Gmail. Both of these lines are ganked from the Vimperator documentation.

The last block sets up commands to use the new “App Tab”s in Firefox 4. These behave like pinned tabs in Chrome, and I use them a lot.

By the way, if you anticipate working a lot on a ~/.vimperatorrc, you may find it useful to install the vim syntax file. It's a little out of date (doesn't have all of the Vimperator 3 configuration options), but it's better than nothing. To install it, drop the linked file into ~/.vim/syntax/ and add the following to your ~/.vimrc:

au BufRead,BufNewFile \.vimperatorrc set filetype=vimperator
au Syntax vimperator source $HOME/.vim/syntax/vimperator.vim

Cheers!


Comments