File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,21 @@ debug() {
47
47
48
48
program_exists () {
49
49
local ret=' 0'
50
- type $1 > /dev/null 2>&1 || { local ret=' 1' ; }
50
+ command -v $1 > /dev/null 2>&1 || { local ret=' 1' ; }
51
+
52
+ # fail on non-zero return value
53
+ if [ " $ret " -ne 0 ]; then
54
+ return 1
55
+ fi
56
+
57
+ return 0
58
+ }
59
+
60
+ program_must_exist () {
61
+ program_exists $1
51
62
52
63
# throw error on non-zero return value
53
- if [ ! " $ret " -eq ' 0 ' ]; then
64
+ if [ " $? " -ne 0 ]; then
54
65
error " You must have '$1 ' installed to continue."
55
66
fi
56
67
}
@@ -115,6 +126,11 @@ create_symlinks() {
115
126
lnif " $source_path /.vimrc.before" " $target_path /.vimrc.before"
116
127
lnif " $source_path /.vim" " $target_path /.vim"
117
128
129
+ if program_exists " nvim" ; then
130
+ lnif " $source_path /.vim" " $target_path /.nvim"
131
+ lnif " $source_path /.vimrc" " $target_path /.nvim/nvimrc"
132
+ fi
133
+
118
134
touch " $target_path /.vimrc.local"
119
135
120
136
ret=" $? "
@@ -160,8 +176,8 @@ setup_vundle() {
160
176
161
177
# ########################### MAIN()
162
178
variable_set " $HOME "
163
- program_exists " vim"
164
- program_exists " git"
179
+ program_must_exist " vim"
180
+ program_must_exist " git"
165
181
166
182
do_backup " $HOME /.vim" \
167
183
" $HOME /.vimrc" \
You can’t perform that action at this time.
0 commit comments