logo       

Re: Vim with Thunderbird: msg#00104

editors.vim.mac

Subject: Re: Vim with Thunderbird

Alan G Isaac wrote:
Are any of you using gVim with Thunderbird?
If so, how? I've followed the usual weblinks,
but asking for ``nofork`` seems not to get me
there.

I'm using the Thunderbird "External Editor" plugin[1] along with a modified script taken from macvim.org[2]. I changed one line of the "gvim" shell script[3] they provide at macvim.org and saved it as ~/bin/gvimwait (script included below). Then I just configure the External Editor plugin to use ~/bin/gvimwait.

The line I changed just removed the ampersand from this line:

exec "$binary" -g $opts ${1:+"$@"} &

Hope this helps,
Michael Henry

[1]: http://globs.org/articles.php?lng=en&pg=2
[2]: http://wiki.macvim.org/wiki/Downloads/ExtraFiles
[3]: http://macvim.org/OSX/files/gvim


Contents of "gvimwait" script follow:

#!/bin/sh
#
# This shell script passes all its arguments to the binary inside the Vim.app
# application bundle. If you make links to this script as view, gvim, etc.,
# then it will peek at the name used to call it and set options appropriately.
#
# Based on a script by Wout Mertens and suggestions from Laurent Bihanic.
# This version is the fault of Benji Fisher, 16 May 2005.

# First, check "All the Usual Suspects" for the location of the Vim.app bundle.
# You can short-circuit this by setting the VIM_APP_DIR environment variable
# or by un-commenting and editing the following line:
# VIM_APP_DIR=/Applications

if [ -z "$VIM_APP_DIR" ]
then
myDir="`dirname "$0"`"
myAppDir="$myDir/../Applications"
for i in ~/Applications ~/Applications/vim $myDir $myDir/vim $myAppDir $myAppDir/vim /Applications /Applications/vim /Applications/Utilities /Applications/Utilities/vim; do
if [ -x "$i/Vim.app" ]; then
VIM_APP_DIR="$i"
break
fi
done
fi
if [ -z "$VIM_APP_DIR" ]
then
echo "Sorry, cannot find Vim.app. Try setting the VIM_APP_DIR environment variable to the directory containing Vim.app."
exit 1
fi
binary="$VIM_APP_DIR/Vim.app/Contents/MacOS/Vim"

# Next, peek at the name used to invoke this script, and set options
# accordingly.

name="`basename "$0"`"
gui=
opts=

# GUI mode, implies forking
case "$name" in g*|rg*) gui=true ;; esac

# Restricted mode
case "$name" in r*) opts="$opts -Z";; esac

# vimdiff and view
case "$name" in
*vimdiff)
opts="$opts -dO"
;;
*view)
opts="$opts -R"
;;
esac

# Last step: fire up vim.
# GUI mode will always create a new Vim instance, because Vim can't have
# more than one graphic window yet.
# The program should fork by default when started in GUI mode, but it does
# not; we work around this when this script is invoked as "gvim" or "rgview"
# etc., but not when it is invoked as "vim -g".
if [ "$gui" ]; then
# Note: this isn't perfect, because any error output goes to the
# terminal instead of the console log.
# But if you use open instead, you will need to fully qualify the
# path names for any filenames you specify, which is hard.
exec "$binary" -g $opts ${1:+"$@"}
else
exec "$binary" $opts ${1:+"$@"}
fi



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise