forked from shawwn/scrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework mvim script to open existing files using
open -a MacVim
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
file="$1" | ||
|
||
# Does the specified file already exist? | ||
if [ -f "$file" ] | ||
then | ||
# Are we opening mvim without any extra args? | ||
if [ -z "$2" ] | ||
then | ||
# Then try to open the existing file in an existing MacVim editor, | ||
# instead of spawning a new one. | ||
exec open -a MacVim "$@" | ||
fi | ||
fi | ||
|
||
# Otherwise fall back to the standard mvim script. | ||
exec mvim-std "$@" | ||
|