Skip to content

Commit

Permalink
Rework mvim script to open existing files using open -a MacVim
Browse files Browse the repository at this point in the history
  • Loading branch information
shawwn committed Jan 5, 2023
1 parent 3c4209c commit 58fb113
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions mvim
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 "$@"

0 comments on commit 58fb113

Please sign in to comment.