pentadactyl - Set external editor to be vim termnial

Solution 1:

Since vim is a terminal application, it relies on being run inside a terminal so that it can show its user interface. The terminal is then responsible for rendering all that in the context of the desktop you're using. So, all you need to add to this command is the terminal invocation.

Here's what works for me. I'm using Debian 6 with Gnome, FF20 and the nightly Pentadactyl build (hg6923 today):

set editor='gnome-terminal -e "vim +<line> +\"sil! call cursor(0, <column>)\" <file>"'

You can also (eek!) make it work on Windows, like so:

set editor='cmd /c vim +<line> +"sil! call cursor(0, <column>)" <file>'

We have to add an extra layer of quotes to pass the whole vim execution string to non-Windows terminals, but other than that, it's pretty much the same command. Vim automatically moves to the right file, line, and column when you open the file. It then waits until you exit vim, and, if you're editing an input field, updates that field with the new text.

As a warning, though, the doc does say that there might be problems with some terminals:

:help faq-editor-fork

Why doesn't external input field editing work with my 'editor' setting?

Unfortunately, external editors which return immediately, before editing is complete, are not supported. This means that gvim, for instance, must be run with the -f flag, and editors run from a terminal must not connect to a remote process. In the case of Rxvt-unicode, this means that the urxvtc program is not an option, and Gnome Terminal is very likely not useable under any circumstances.

Confusingly, as we've just seen, gnome-terminal works just fine for me. Caveat editor.