Permalink
Browse files

Check file existence during install and uninstall

It might be the case that the computer where quick-vim is being installed
doesn't even have a default .vimrc and .vim files.
  • Loading branch information...
Lars-Magnus Skog
Lars-Magnus Skog committed May 28, 2012
1 parent ffee2f6 commit 89768e65bd1f6eeae57145427f6aca253b419b55
Showing with 16 additions and 4 deletions.
  1. +16 −4 quick-vim
View
@@ -23,8 +23,14 @@ backup () {
echo 'skipping backup'
else
mkdir -p ./backup
- mv ~/.vimrc ./backup/.vimrc
- mv ~/.vim ./backup/.vim
+ if [ -e ~/.vimrc ]
+ then
+ mv ~/.vimrc ./backup/.vimrc
+ fi
+ if [ -e ~/.vim ]
+ then
+ mv ~/.vim ./backup/.vim
+ fi
fi
}
@@ -51,8 +57,14 @@ uninstall () {
then
rm ~/.vimrc
rm -rf ~/.vim
- mv ./backup/.vimrc ~/.vimrc
- mv ./backup/.vim ~/.vim
+ if [ -e ./backup/.vimrc ]
+ then
+ mv ./backup/.vimrc ~/.vimrc
+ fi
+ if [ -e ./backup/.vim ]
+ then
+ mv ./backup/.vim ~/.vim
+ fi
rm -rf ./backup
fi
}

0 comments on commit 89768e6

Please sign in to comment.