vi style key bindings in Firefox

October 9th, 2006 by Rohan

What a huge browsing improvement this gave me. I always found myself pressing j or k instead of the up/down arrow keys. I learnt how to edit the Firefox key bindings from an article which I don’t remember the link to.

Its quite simple though

  1. Open folder “Your firefox installation directory”/chrome. I use a linux box, and my Firefox version is 1.5.0.7, so for me this was /usr/lib/firefox-1.5.0.7/chrome
  2. Unzip the file toolkit.jar (You may want to take a backup of this file first)
  3. Open content/global/platformHTMLBindings.xml in your Editor
  4. Change your keybindings as required. Here’s what my changes look like:

    <handler event=”keypress” key=”k” command=”cmd_scrollLineUp” />
    <handler event=”keypress” key=”j” command=”cmd_scrollLineDown” />
    <handler event=”keypress” key=”h” command=”cmd_scrollLeft” />
    <handler event=”keypress” key=”l” command=”cmd_scrollRight” />

  5. Some additional changes I did

    <handler event=”keypress” key=”g” command=”cmd_beginLine”/>
    <handler event=”keypress” key=”g” modifiers=”shift” command=”cmd_endLine”/>

  6. Save the file and zip the contents folder back into toolkit.jar
  7. Restart Firefox

The modifiers attribute is really helpful. That last one which replaces my “End” key is “G”.

Also helpful to know, is that the space key is for PageDown, and shift+space is for PageUp

[Post to Twitter] Tweet This Post  [Post to Facebook] Facebook 

Leave a Reply




Tweet This Post links powered by Tweet This v1.4.1, a WordPress plugin for Twitter.