SGMLXML.net A place for SGML and XML application developers.

September 24, 2005

Setting up VI navigation commands in Firefox 1.0.5 or later

Filed under: Software — cangione @ 1:20 am

vi geeks (Emacs is ok too I guess....) this is tooooooooooo cool! For
those of us that actually remember how to do things before the
invention of the mouse this modification is for you in Firefox! The
following procedure will add keybindings that simulate vi navigation
movements such as the j and k keys.

  1. For versions following 1.0.5 the platformHTMLBindings.xml
    file has moved inside the $firefox_home/chrome/toolkit.jar
    (content/global/platformHTMLBindings.xml within the JAR file)
    .
    • You'll need to extract the existing file from the archive,
      modify it, then update the archive.
    • The simplest way to modify the file is to move the jar file
      into a working directory, unpack it, modify the file, the repack it
      into the jar. Suggest that you also make a backup of the original toolkit.jar file while you are at it.
  2. Move the JAR file to a working directory:
    cd $MOZILLA_HOME/chrome/
    cp toolkit.jar $WORKING_DIRECTORY
    cd $WORKING_DIRECTORY
  3. Unpack the JAR file with the Java Archive Utility:
    jar -xf toolkit.jar
  4. Modify the file which will now be located at
    $WORKING_DIRECTORY/content/global/platformHTMLBindings.xml

    Add the entries listed below as children of the <binding id="browser"><handlers> element:

    <handler event="keypress" key="k"command="cmd_scrollLineUp"/>
    <handler event="keypress" key="j" command="cmd_scrollLineDown"/>
    <handler event="keypress" key="l" command="cmd_scrollRight"/>
    <handler event="keypress" key="h" command="cmd_scrollLeft"/>
  5. Repack the JAR file:
    cd $WORKING_DIRECTORY
    jar -cf toolkit.jar content/	
    
  6. Copy the new JAR file back.
  7. Restart the browser and get away from the dreaded Carpal Tunnel
    syndrome!

NOTE: If you have turned on the Advanced Firefox
option "Begin finding when you being typing" this should
be turned off. By typing a /
character you can start a search for any text on the page and by typing
a ' character you can start a
search for any link on a page. For more info refer to the Firefox
Keyboard Shortcuts
page.

CREDITS
I believe that this is the first page that has been updated to
accomplish this task for vi navigation on Firefox versions after 1.0.5 (HINT:
If you are using a version of Firefox before 1.0.6 YOU ARE NOT
PRACTICING SAFE BROWSING).
The instructions provided here were
based on instructions for earlier versions of Firefox gathered from the
following pages:

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress