Bring the mightiness of Vim to Firefox! If you're ready for a fully keyboard-driven browser, the Vimperator add-on for Firefox can help you do away with mouse-based drudgery and add the awesomeness of vi-like keybindings to Firefox 3.5 and later.
Want to take full keyboard control of Firefox? Tired of having to mouse around the Web? Firefox has a good set of shortcuts by default, but if you want to go completely keyboard-driven, take a look at Vim-inspired extension Vimperator.
Vimperator is an amazingly complete add-on for Firefox that gives you access to almost all of Firefox’s features from the keyboard. It takes its inspiration from the popular vi-clone Vim, so many of the keybindings will already be familiar to you if you’re a Vim user. Even if not, Vimperator provides a great way to ditch the mouse and control Firefox from the keyboard.
The Vimperator extension is available from the Mozilla Add-ons for Firefox site. It should work with current releases of Firefox, the current 2.2 release of Vimperator works with Firefox 3.5 through 3.6. Once you’ve installed Vimperator, you’ll get a bare-bones Firefox window with almost no UI elements, save the tab bar, scroll bar, and status bar at the bottom. The menus and Awesome bar? Gone. Well, not gone, actually. They’re hidden and can be restored, but let’s take Vimperator for a bit of a spin before we fall back on the mouse and menus approach.
Look Ma! No GUI! The Standard Vimperator Interface
Getting Around in Vimperator
Like Vim, Vimperator has modes. The normal mode when you’re browsing using the keyboard, the command-line mode when using Vimperator’s command line, the insert mode for working with text fields on Web sites, and finally the visual mode when you’re selecting text using the keys.
By default, you’ll be in normal mode — which is good, because if it wasn’t the default to be in normal mode then normal wouldn’t be properly named. When in normal mode, you’re using standard vi-like keys for movement and such. To help you get around more quickly, here’s a list of the keys that you’ll want to know to do about 80% of your browsing in Vimperator:
- j – scroll down one line
- k – scroll up one line
- h – scroll to the left
- l – scroll to the right
- G – bottom of the page
- gg – top of the page
- Ctrl-f – scroll down one page
- Ctrl-b – scroll up one page
- gt – next tab
- gT – previous tab
- g0 – first tab
- g$ – last tab
- o – open URL (prompts for URL or string to be passed to default search engine)
- t – open URL in new tab (prompts for URL)
- T – open in new tab (shows current URL for editing)
- :q – close tab
- :qall or ZQ – quit Firefox without saving session
- :xall or QQ – save session and quit Firefox
- / string search for string on the current page
- :help – open Vimperator’s help
As you can see, you can use the keyboard to navigate a page completely. If you want to follow a link on the page a quick way to do that is to just search for the string that’s part of the link. The standard keys will let you scroll through the page, navigate tabs, and open new pages.
Vimperator Hints: Selecting Links, Saving Images, and More
Another way to select links is to use Vimperator’s hints. You can start the QuickHint mode by typing f or F. When you type f you’ll see a bunch of yellow highlights on the page and red numbers. The yellow highlights are the link text (if any) and the red numbers are the numbers that Vimperator is associating with the link. When you enter QuickHint mode, you’ll see “Follow hint:” in the status bar. Type the number associated with the hint or part of the string that is highlighted in yellow. Vimperator will follow the link as soon as it gets enough information to determine which unique link you want to follow. The f will open it in the existing page, F will open it in a new tab. As always, if you decide you don’t want to follow a link after all, just hit Esc.
Hints Mode with Vimperator
But wait, there’s more! Vimperator has an “extended” Hint mode that you enter by pressing the ; key. Want to save an image on a page? Type ;s and then the unique identifier for the page. Want to know more about a link before you follow it? Type ;? and then the identifier, and the link URL will be displayed in the status bar.
When Vimperator and Web Apps Clash
Keyboard-driven browsing is great, right? It’s so great, in fact, that some Web apps already have their own keyboard shortcuts which happen to not play very well with Vimperator. While Vimperator is a great tool on 98% of the Web sites I browse, it’s an enormous hassle to lose the shortcuts for GMail and Google Reader when using Vimperator.
The good news is, you don’t have to lose them, because the Vimperator folks thought of that. Vimperator has a pass-through mode so that all keystrokes (except Esc) are sent to the site normally. To set pass-through mode, just type Ctrl-z and you’ll see a big “– PASS THROUGH –” in the status bar.
While Vimperator is in this mode, you can interact with your Web app normally. When you’re ready to turn off pass-through mode, just hit Esc and you’ll be returned to full keyboard-driven glory.
History and Bookmarks
To view the browser history, just type :history which will show you the full Firefox history. To move back one in the history, use Ctrl-o or H and to move forward in your browser history, use Ctrl-i or L. Just like Vim, you can add a “count” to the command as well — so if you want to go back two pages, just use 2H or to go forward three pages you can use 3L.
Naturally, bookmarks are also keyboard-driven. To add a new bookmark, just type A. This will add a new bookmark for the current page. Or you can remove a bookmark for the page by hitting A again. This is similar to just using the star in the Awesome bar with standard Firefox.
But standard bookmarks are a bit slow. Fans of Speed Dial in other browsers will love Vimperator’s QuickMarks feature. Vimperator gives you 62 spaces (a through z, A through Z, and 0 through 9) to set QuickMarks that you can get with just a few keystrokes. Here’s how it works: To set a QuickMark, type M followed by an letter or number (0 through 9 only, QuickMarks doesn’t do double digits). For instance, if you wanted to assign Linux-Mag.com to the letter L while you were on the page, type ML.
To go to that bookmark, type:
Another way to set a QuickMark is to use :qmark and pass the URL or URLs manually. So if you wanted to assign several pages to a QuickMark, you could use:
:qmark a http://www.linux-mag.com/, http://lwn.net/, http://news.google.com/
Once that’s set, running “goa” will open each site in a new tab. This can be really handy if you have a group of tabs that you use on a regular basis.
One note on Vimperator bookmarks: Using QuickMarks is pretty speedy, but accessing a large number of bookmarks using Vimperator can be a bit laggy. If you have tons of bookmarks (as I do), calling :bmarks with no arguments will take quite a while for Vimperator to pull up.
Return to Normal
If you need to get back to a regular session with Firefox, you can re-enable all the standard GUI goodness by running one quick command:
Once you hit Enter, you’ll see that you now have all your standard menus. When you’re ready to go back to Vimperator’s standard GUI-less mode, use this:
That can be useful if you need to get to a menu item quickly, especially for menu items created by other extensions. Note that you can get to most of Firefox’s dialogs and such using the :dialog command. So if you need to get to the downloads dialog, use :dialog downloads, if you need to see the GUI history dialog, use :dialog history. See all the available dialogs by going to :help dialog in Vimperator’s expansive documentation.
This is by no means a complete guide to Vimperator, but should be enough to get you started. Vimperator is much like Vim: you really have to stick with it to get the full force and effect of the tool. If you’re not familiar with Vim or vi-like keybindings, Vimperator might be a bit frustrating at first. It might seem like you can’t do everything with Vimperator that you can do with a mouse. For the most part, though, you can — it just takes a bit of patience and going through the Vimperator help, which is amazingly complete. If you use Firefox a lot, it should only take a few days before you start building the muscle memory to use the keyboard instead of the mouse in most cases.
Of course, nothing stops you from using the mouse with Vimperator. You can still click links, use the context menu, and so forth. It’s just not as much fun as using the keyboard!
Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62