Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to abort from Vim exit code #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ touch $TMPFILE
# Linux
if [[ $OSTYPE == "linux-gnu" ]]; then
chmod o-r $TMPFILE # Make file only readable by you
gvim $VIM_OPTS $TMPFILE
cat $TMPFILE | xclip -selection clipboard
if gvim $VIM_OPTS $TMPFILE; then
cat $TMPFILE | xclip -selection clipboard
else
err "Vim aborted with a non-zero exit code."
fi

# OSX
elif [[ $OSTYPE == "darwin"* ]]; then
Expand All @@ -72,13 +75,16 @@ elif [[ $OSTYPE == "darwin"* ]]; then
"mvim must have been moved or uninstalled.\nPlease make sure it is" \
"available in your path and then reinstall vim-anywhere."

$mvim_path $VIM_OPTS $TMPFILE
# todo, fix invalid file
if $mvim_path $VIM_OPTS $TMPFILE; then
# NOTE
# Here we set LANG explicitly to be UTF-8 compatible when copying text. The only way that was explicitly
# setting this to en_US.UTF-8. This may eventually cause issues with other languages. If so, just remove
# the LANG setting.
LANG=en_US.UTF-8 pbcopy < $TMPFILE
else
err "MacVim aborted with a non-zero exit code."
fi

# NOTE
# Here we set LANG explicitly to be UTF-8 compatible when copying text. The only way that was explicitly
# setting this to en_US.UTF-8. This may eventually cause issues with other languages. If so, just remove
# the LANG setting.
LANG=en_US.UTF-8 pbcopy < $TMPFILE
osascript -e "activate application \"$app\""
fi