Emacs Keybindings - FirefoxFrom MozillaZine Knowledge Base
[edit] GNU/LinuxFirefox uses the GTK setting to determine whether Emacs-like/Readline-like keybindings are active in text fields. There are two different methods depending upon whether or not you run Gnome. If in doubt, it doesn't hurt to do both. [edit] Standard method: .gtkrc-2.0To enable Emacs keybindings, add the line gtk-key-theme-name = "Emacs" to [edit] Gnome method: gconftool-2If the above method doesn't work, it is probably because you are running Gnome >=2.8 which has a Microsoft Windows® style "registry" called GConf. There is a graphical registry editor, gconftool-2 --set /desktop/gnome/interface/gtk_key_theme Emacs --type string You need not restart. All current and future firefox processes will now use Emacs key bindings. If you decide that you don't like it, you can use [edit] The KeybindingsThe shortcuts are often called Emacs keybindings, but they're actually more similar to keybindings in Readline. When these keybindings are enabled, they override the standard keybindings in Gnome and Firefox (when a text entry field has focus).
[edit] Unsupported keysAdditional Readline keys not supported by Firefox. Ctrl+T transpose characters Ctrl+Y yank (like paste) Ctrl+S search Ctrl+R reverse search Ctrl+J return Ctrl+M carriage return Ctrl+L redraw [edit] Any OS: ConkerorConkeror is an extension which makes Firefox look and act like Emacs. It is a much more thorough change to the UI than simple key bindings and is not for the faint of heart. Conkeror can be selectively disabled so that "normal" Firefox windows can be opened simultaneously with Conkeror windows. [edit] WindowsFor Windows you can download XKeymacs, an OpenSource keybinder that works with most Windows apps. You can also follow the instructions below. [edit] Any OS, without GTKFor both Windows and OS X, you can manually edit the [edit] Versions preceding 1.0.5For versions before 1.0.5 this file is located at [edit] Versions following 1.0.5As of version 1.0.5 The simplest way to modify the file is to move the jar file to a working directory, unpack it, modify the desired file, then recompress the jar and replace the older one. You may want to make a backup of this file in case anything goes wrong. Follow these steps, where Move the JAR file to a working directory: cd $MOZILLA_HOME/chrome/ cp toolkit.jar $WORKING_DIRECTORY cd $WORKING_DIRECTORY Unpack the JAR file with the Java Archive Utility (you can alternatively use unzip and zip -r instead of jar -xf and jar -cf): jar -xf toolkit.jar Modify the file which will now be located at cd $WORKING_DIRECTORY jar -cf toolkit.jar content/ Copy the new JAR file back. (You may want to make a backup!) cp toolkit.jar $MOZILLA_HOME/chrome/
[edit] Entries to add to platformHTMLBindings.xmlAdd to the <!-- Emacsish single-line motion and delete keys --> <handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/> <handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/> <handler event="keypress" key="b" modifiers="control" command="cmd_charPrevious"/> <handler event="keypress" key="f" modifiers="control" command="cmd_charNext"/> <handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/> <handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/> <handler event="keypress" key="w" modifiers="control" command="cmd_deleteWordBackward"/> <handler event="keypress" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/> <handler event="keypress" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/> Add to the <!-- Emacsish single-line motion and delete keys --> <handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/> <handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/> <handler event="keypress" id="key_left" key="b" modifiers="control" command="cmd_charPrevious"/> <handler event="keypress" id="key_right" key="f" modifiers="control" command="cmd_charNext"/> <handler event="keypress" id="key_delback" key="h" modifiers="control" command="cmd_deleteCharBackward"/> <handler event="keypress" id="key_delforw" key="d" modifiers="control" command="cmd_deleteCharForward"/> <handler event="keypress" id="key_delwback" key="w" modifiers="control" command="cmd_deleteWordBackward"/> <handler event="keypress" id="key_del_bol" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/> <handler event="keypress" id="key_del_eol" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/> <!-- Emacsish multi-line motion and delete keys --> <handler event="keypress" id="key_linedown" key="n" modifiers="control" command="cmd_lineNext"/> <handler event="keypress" id="key_lineup" key="p" modifiers="control" command="cmd_linePrevious"/> |