forked from cknadler/vim-anywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update
executable file
·54 lines (42 loc) · 875 Bytes
/
update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
#
# vim-anywhere - use Vim whenever, wherever
# Author: Chris Knadler
# Homepage: https://www.github.com/cknadler/vim-anywhere
#
# Updates vim-anywhere
set -e
###
# opts
###
while getopts ":v" opt; do
case "$opt" in
v) set -x ;;
\?) echo "Invalid option: -$OPTARG" >&2 ;;
esac
done
###
# defs
###
err() { echo -e "$@" 1>&2; }
AW_PATH=$HOME/.vim-anywhere
###
# update
###
if [ ! -d $AW_PATH ]; then
err "vim-anywhere doesn't seem to be installed."
exit 1
fi
# if we are in a git repo, unset env vars
if git rev-parse --git-dir &> /dev/null; then
unset $(git rev-parse --local-env-vars) &> /dev/null
fi
pushd $AW_PATH
git pull origin master
[ $? -ne 0 ] && exit 1
popd
# OSX only
if [[ $OSTYPE == "darwin"* ]]; then
cp -R $AW_PATH/VimAnywhere.workflow $HOME/Library/Services
fi
echo "vim-anywhere has been successfully updated!"