vi-style scrolling in firefox

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For those of us with hands glued to the standard typing position,
the inability of firefox to scroll vi-style is a constant irritation.
The necessity to lift the hand over to the unnatural arrow keys, or god
forbid, the mouse, is just burdensome.  Why can't firefox obey the 
standard convention?  - move down with the right index finger,
up with the middle finger, left by reaching left, and right with the
third finger?  Scroll up a full page by reaching up to u, and down
with the thumb.

It turns out to be fairly simple to teach firefox to do this, moreover
without affecting its other "normal" behaviour, so the question remains -
why isn't this done standardly?  I don't know that answer.

Does anyone know why?
Does anyone know how to get it added, officially?

It is merely necessary to add these definitions to the file,
platformHTMLBindings.xml

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

However, this file is well concealed in
/usr/lib/firefox-1.0.7/chrome/toolkit.jar which is a zipped bunch of
files.  This must be unzipped, the file edited, and the package
rezipped.  


Here's a recipe to fix it on Fedora Core 4.  
Unzip the jar file, saving a copy.

  cp -p  /usr/lib/firefox-1.0.7/chrome/toolkit.jar  /tmp
  cd /tmp
  cp -p  toolkit.jar  toolkitSTD.jar

  mkdir /tmp/jar
  cd /tmp/jar
  unzip ../toolkit.jar

Edit /tmp/jar/content/global/platformHTMLBindings.xml thusly:

# diff -C 4 /tmp/jarSTD/content/global/plat* /tmp/jar/content/global/plat*
*** /tmp/jarSTD/content/global/platformHTMLBindings.xml   Fri Sep 10 04:11:25 2004
--- /tmp/jar/content/global/platformHTMLBindings.xml    Thu Nov 17 16:41:02 2005
***************
*** 56,63 ****
--- 56,69 ----
  
        <handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop"/>
        <handler event="keypress" keycode="VK_END" command="cmd_scrollBottom"/>
  
+       <handler event="keypress" key="h" command="cmd_scrollLeft"/>
+       <handler event="keypress" key="j" command="cmd_scrollLineDown"/>
+       <handler event="keypress" key="k" command="cmd_scrollLineUp"/>
+       <handler event="keypress" key="l" command="cmd_scrollRight"/>
+       <handler event="keypress" key="u" command="cmd_scrollPageUp" />
+ 
        <handler event="keypress" key="x" command="cmd_cut" modifiers="accel"/>
        <handler event="keypress" key="c" command="cmd_copy" modifiers="accel"/>
        <handler event="keypress" key="v" command="cmd_paste" modifiers="accel"/>
        <handler event="keypress" key="z" command="cmd_undo" modifiers="accel"/>


This adds 5 lines that define actions for the h j k l and u keys.
These augment the previously defined arrow keys and the space bar.

Now reconstruct the toolkit.jar file using zip with no compression 
and copy the revised (and STD) versions of toolkit.jar back to the
original directory:

  cd /tmp/jar
  zip -r -0 ../toolkit.jar content

  cp -p /tmp/toolkit* /usr/lib/firefox-1.0.7/chrome

and restart firefox.


Unfortunately, a similar edit doesn't seem to work for thunderbird,
although similar files exist in /usr/lib/thunderbird-1.0.7/chrome/.

I suppose similar motion commands for emacs lovers could also be added,
but I haven't tried, having no interest.

    j    C-n    down
    k    C-p    up
    h    C-b    left
    l    C-f    right
    u    C-v    scroll up
   <sp>  M-v    scroll down

Unless the mozilla developers accept this simple addition, these
changes will have to be reinstated whenever a new release overwrites
them.

-- 
	David A. De Graaf    DATIX, Inc.    Hendersonville, NC
	dad@xxxxxxxxxxxx     www.datix.us


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux