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

Re: vi-style scrolling in firefox



On 11/18/05, David A. De Graaf <dad datix 2y net> wrote:
> 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 datix 2y net     www.datix.us

You must have forgotten how unnatural those keystrokes were when you
first learned them! I am learning them now (I take upon myself to
learn and use vi), but I still get confused every now and then. For my
(vanilla vim) install, u is NOT up a page, rather it is undo. So
whatever you call standard is probably better called "what David is
used to".

The logical reasoning behind the current firefox key combos is the
fact that most firefox users are running you-know-which OS and for
them (they think that vi means 6) the 'standard' up key is marked with
an up arrow. Firefox developers rightly chose uniformity across
platform versions, and gave the same key combination to linux and mac
platforms. Anyone who doesn't like it, can change it. Yes, it is a
pain to change it, but so was configuring my pptp internet connection.
Or, for that matter, so was learning the vi keystrokes!

Dotan Cohen
http://technology-sleuth.com/short_answer/how_can_i_be_safe_online.html


2


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