Fix input box keybindings in Firefox
[ Note that I am in the process of migrating these blog posts from Wordpress, and as such it may contain incorrect formatting, missing links, etc. My old site is available at http://www-old.perkin.org.uk/ so if you find something obviously broken please let me know. Thanks! ]
Those of us used to command line editing will no doubt have been frustrated many times in Firefox when editing text in an input box and subconciously hitting ctrl-w to delete-word, only to have the tab close and your work deleted.
Thankfully there is a workaround to this. It used to be a case of adding the following to .gtkrc:
gtk-key-theme-name = "Emacs"
However these days it’s a gconf setting:
$ gconftool-2 --set /desktop/gnome/interface/gtk_key_theme Emacs --type string
This will bind ctrl-w to delete-word when in an input box, but retain the close tab binding elsewhere, a nice implementation of DWIM. See this page for more information.