2007年1月13日星期六

firefox快捷键

由于使用vi习惯,经常在firefox里想用"j","k"键去向下翻页.

Google一下,还真有人和我想法一样:

http://johan.fredin.info/firefox_vi-bindings.html
详细内容为:
http://www.mozilla.org/unix/customizing.html
步骤为:
{Firefox_Install_Dir}\res\builtin\下建立文件userHTMLBindings.xml 文件.
文件内容为
<?xml version="1.0"?>
<!-- In order to work correctly, this file must be named -->
<!-- res/builtin/userHTMLBindings.xml in the mozilla tree. -->
<bindings id="htmlBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<binding id="browserUser">
<handlers>
<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"/>
</handlers>
</binding>
</bindings>

试着做了一下,完全不行,后来发现是firefox 2 .0的架构和以前不太一样,于是继续Searching....终于发现Emacs爱好者修改Firefox key binding的文档

http://kb.mozillazine.org/Emacs_Keybindings_(Firefox)

照意思...firefox 2.0已经将key_binding的xml文件打包进{Firefox_Install_Dir}\chrome\toolkit.jar文件里...

再试:
   1. 找到toolkit.jar文件{Firefox_Install_Dir}\chrome\toolkit.jar
2. 解压文件: jar -xf toolkit.jar
3. 修改 content\global\platformHTMLBindings.xml文件<binding id="browser">下加入

<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" />

4. 打包文件: jar -cf toolkit.jar
5. 重启firefox

ok,现在"k,j,h,l"分别代替上下左右键,快捷多了... :D

没有评论: