Ches Martin committed d22c9db

Track the mvim bin script

Comments (0)

Files changed (1)

+# This shell script passes all its arguments to the binary inside the
+# 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 (with modifications by Nico
+# Weber and Bjorn Winckler, Aug 13 2007).
+# First, check "All the Usual Suspects" for the location of the 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" ]
+	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/" ]; then
+			VIM_APP_DIR="$i"
+			break
+		fi
+	done
+if [ -z "$VIM_APP_DIR" ]
+	echo "Sorry, cannot find  Try setting the VIM_APP_DIR environment variable to the directory containing"
+	exit 1
+# Next, peek at the name used to invoke this script, and set options
+# accordingly.
+name="`basename "$0"`"
+# GUI mode, implies forking
+case "$name" in m*|g*|rm*|rg*) gui=true ;; esac
+# Restricted mode
+case "$name" in r*) opts="$opts -Z";; esac
+# vimdiff, view, and ex mode
+case "$name" in
+	*vimdiff)
+		opts="$opts -dO"
+		;;
+	*view)
+		opts="$opts -R"
+		;;
+	*ex)
+		opts="$opts -e"
+		;;
+# Last step:  fire up vim.
+# 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:+"$@"}
+	exec "$binary" $opts ${1:+"$@"}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.