2007-08-26

用vim风格使用firefox


文件: keyconfig.tar.gz
大小: 13KB
下载: 下载

http://blog.chinaunix.net/u/9465/showart_199548.html

Vim keys in firefox

把firefox的操作,页面浏览设置为vim的风格,即经典的hjkl. 虽然Arrow Down和Arrow Up可以翻阅页面,但手情不自禁地去敲hj两个键。可以独立用keyconfig的插件,再设置一下就可以实现。或者再用另外一个辅助keyconfig的插件:functions for keyconfig相对方便一点实现。

(一)独立用keyconfig

  1. 首先到 http://mozilla.dorando.at 上安装keyconfig.xpi插件(本文附件)
  2. 进入~/.mozilla/firefox/[yours].default/目录,编辑文件prefs.js,将一下内容插入到文件末尾: user_pref("keyconfig.main.xxx_key_ScrollPageUp", "!][][][goDoCommand('cmd_scrollPageUp');"); user_pref("keyconfig.main.xxx_key_ScrollPageDown", "!][][][goDoCommand('cmd_scrollPageDown');"); user_pref("keyconfig.main.xxx_key_ScrollLineUp", "!][][][goDoCommand('cmd_scrollLineUp');"); user_pref("keyconfig.main.xxx_key_ScrollLineDown", "!][][][goDoCommand('cmd_scrollLineDown');"); user_pref("keyconfig.main.xxx_key_ScrollLeft", "!][][][goDoCommand('cmd_scrollLeft');"); user_pref("keyconfig.main.xxx_key_ScrollRight", "!][][][goDoCommand('cmd_scrollRight');"); user_pref("keyconfig.main.xxx_key_ScrollTop", "!][][][goDoCommand('cmd_scrollTop');"); user_pref("keyconfig.main.xxx_key_ScrollBottom", "!][][][goDoCommand('cmd_scrollBottom');"); user_pref("keyconfig.main.xxx_key_findTypeLinks", "!][][][goDoCommand('cmd_findTypeLinks');");
  3. 先关闭firefox,然后再保存修改过的prefs.js文件。否则,firefox关闭后会清空 firefox的剪贴板,同时重写prefs.js文件,所以需要先复制上面的代码,再关闭firefox,最后保存prefs.js文件。
  4. 重新启动firefox,在tools->keyconfig中设置相应的快捷键。
(二)keyconfig 与 functions for keyconfig联合使用

用keyconfig的一个扩展插件functions for keyconfig就可以不用操作prefs.js,直接设置,而这个插件是以keyconfig为基础的,也就是必须先安装keyconfig。

http://www.pqrs.org/~tekezo/firefox/extensions/functions_for_keyconfig/

(三)直接改ff配置文件,不需要任何插件

1. 找到[firefox_dir]/chrome/toolkit.jar (备份一下)

2. 解压global文件夹下的platformHTMLBindings.xml文件

3. 修改platformHTMLBindings.xml文件
找到如下关键字(123行):
<binding id="browser">
.....

<handler event="keypress" keycode="VK_UP" command="cmd_scrollLineUp" />
<handler event="keypress" keycode="VK_DOWN" command="cmd_scrollLineDown"
/>
<handler event="keypress" keycode="VK_LEFT" command="cmd_scrollLeft" />
<handler event="keypress" keycode="VK_RIGHT" command="cmd_scrollRight" />

在此代码后面添加:
<!-- YY's Add for vi(m) keybindings -->
<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" />

4. 将platformHTMLBindings.xml文件再加入 toolkit.jar文件

5. 打开firefox,在设置页面(运行about:config)中确认
accessibility.typeaheadfind 为false

这样就可以啦

没有评论:

How to upgrade micronucleus

micro micronucleus nucleus 是 ATtiny/ ATMega328p的bootloder, 它的过人之处是给这些芯片带来usb支持. 使得它们可以直接通过usb口来烧录. 我购买了很多 digispark 开发板. 这些开发板小巧方便价格低廉. ...