Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there nay way we can set vim terminal to be external editor of pentadactyl ? Thanks

I've tried this but it seems to not work:

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

P/S: My OS is Mac

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.