Today I posted a tip on vimperator.org that helps me use Vimperator on my MacOS system. I'm reposting that tip here.
To make a long story short, try an editor setting like
or (if you prefer gvim):set editor='bash -lc "mvim -f \$*" mvim '
Then you should be able to hit CNTRL+I to launch an external editor for textareas. There are simpler solutions and explanations below.:set editor='bash -lc "gvim -f \$*" gvim '
Shelling out to external commands is hairier in OS X than it is on other platforms.
In my case, I use MacVim, which includes a script mvim that can be called as
so that the script will wait for the GUI to exit before it exits. This functionality is identical to the gvim found with other Vim distributions (including older Vim distros for OS X).mvim -f ...
My mvim script is in /usr/local/bin. Unfortunately, the PATH environment variable that sits behind user processes has to be set in an special ~/.MacOSX/environment.plist file, and the default PATH does not include /usr/local/bin. If you don't believe me, try
As you can see, those environment variables are very different from the ones you'd expect in a "login shell." You could go add an appropriate environment.plist file to match your login shell, but then you'll have to keep it up-to-date after every change to your shell profile. As a consequence, it's probably a good idea to:!env
Then you'll notice that :!env gives you more expected results. However, Vimperator won't run the editor unless it can find it in what Firefox thinks is the PATH, and so shcf won't help you.:set shcf='-lc'
A simple solution is to
For most people, this solution will be perfect. However, some will notice that their favorite utilities (e.g., /opt/local/bin/par or /sw/bin/aspell) will not be accessible in the editor (unless the environment.plist file is modified).:set editor='/usr/local/bin/mvim -f'
So the final solution is to use bash as your external editor, and have it operate as a login shell that calls your editor of choice.
Here, bash calls mvim and passes "mvim" as $0 and everything following bash as $1, $2, and so on...:set editor='bash -lc "mvim -f \$*" mvim '