We explored vimb browser with vim like controls recently. A new extension, pterosaur brings vim editing capabilities to Firefox browser’s text fields. Once you install the extension, you can use any vim shortcut you use for editing text in vim.
Pterosaur uses the vimbed plugin to embed vim behind a running instance of Firefox. The keystrokes are routed through the vim instance. The extension tries to be unobtrusive. Though it edits every non-password textbox with vim, it starts out in vim’s insert mode and enters vim’s select mode when you select text with the mouse. This allows you to use traditional Firefox mouse behaviour, while still being able to leave insert mode and use anything you want from vim.
Pterosaur integrates well with both Pentadactyl and Vimperator extensions which allow vim-like control over the rest of your browser.
Pterosaur needs vim with +clientserver support compiled in. To check, run:
$ vim --version | grep clientserver
The output should show a + sign before clientserver.
The vim package on Ubuntu does not have the support but gvim does. To install, run:
$ sudo apt-get remove vim $ sudo apt-get install vim-gnome
Once done, install the extension from Firefox.
Pterosaur has several configuration options. To access them visit about:config in Firefox and type extensions.pterosaur. Options supported at the time of writing are:
- enabled: set to false to disable pterosaur
- contentonly: When set to false, pterosaur uses vim in the chrome areas of the browser window (like the awesomebar and firebug). When set to true, only web content uses vim. Defaults to true.
- allowprivate: By default, pterosaur will not send keys typed in private browsing mode to vim. If you set this to true, it will not treat private browsing any differently than normal browsing.
- autorestart: Defaults to true. If you quit vim with autorestart enabled, vim will start back up automatically. Otherwise, typing
:qin normal mode will make pterosaur unusable.
- verbose: Causes pterosaur to display extra information to the browser console.
- restartnow: Set this to true to restart pterosaur’s vim instance. Especially useful if you don’t have autorestart enabled or if you switched vimbinaries and don’t want to restart Firefox. This automatically sets back to false after half a second so that it can be used again.
Pentadactyl and Vimperator users can also restart vim using the :pterosaurrestart command.
- vimbinary: Set this to the path of the vim binary you want pterosaur to use. Pick a terminal vim binary with +clientserver enabled.
- debugtty: Set this to a tty to display pterosaur’s running vim process on that tty. Type
ttyin any terminal window to get the string you’ll need to type. It should look something like
- rcfile: Set this to a file (default: ~/.pterosaurrc) to have pterosaur’s vim load that file on startup. This is useful for pterosaur-specific vim settings.
- exitkey: Pressing this key will cause the textbox to lose focus if pressed in normal mode or immediately following an
<Esc>press. The default value is
<Esc>. Control values can be used in the form
- envoverrides: A space separated list of environment variables with values used to to override the defaults when calling vim. For example, you might set this value to something like:
if you are using firefox with X11 forwarding. Most environment variables not specified here will inherit their values from Firefox.
On GitHub: pterosaur