diff --git a/.gitmodules b/.gitmodules index b548196..28c5ea9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,27 +1,27 @@ -[submodule "pathogen"] - path = pathogen +[submodule "vim/pathogen"] + path = vim/pathogen url = https://github.com/tpope/vim-pathogen -[submodule "bundle/molokai"] - path = bundle/molokai +[submodule "vim/bundle/molokai"] + path = vim/bundle/molokai url = https://github.com/tomasr/molokai -[submodule "bundle/vim-markdown"] - path = bundle/vim-markdown +[submodule "vim/bundle/vim-markdown"] + path = vim/bundle/vim-markdown url = https://github.com/tpope/vim-markdown -[submodule "bundle/vim-less"] - path = bundle/vim-less +[submodule "vim/bundle/vim-less"] + path = vim/bundle/vim-less url = https://github.com/lunaru/vim-less -[submodule "bundle/syntastic"] - path = bundle/syntastic +[submodule "vim/bundle/syntastic"] + path = vim/bundle/syntastic url = https://github.com/scrooloose/syntastic.git -[submodule "bundle/vim-javascript"] - path = bundle/vim-javascript +[submodule "vim/bundle/vim-javascript"] + path = vim/bundle/vim-javascript url = https://github.com/pangloss/vim-javascript -[submodule "vim-vimlint"] - path = bundle/vim-vimlint +[submodule "vim/bundle/vim-vimlint"] + path = vim/bundle/vim-vimlint url = https://github.com/syngan/vim-vimlint -[submodule "bundle/vim-vimlparser"] - path = bundle/vim-vimlparser +[submodule "vim/bundle/vim-vimlparser"] + path = vim/bundle/vim-vimlparser url = https://github.com/ynkdir/vim-vimlparser -[submodule "bundle/vim-latex"] - path = bundle/vim-latex +[submodule "vim/bundle/vim-latex"] + path = vim/bundle/vim-latex url = git@github.com:lervag/vim-latex.git diff --git a/install.sh b/install.sh index 8414a25..12db177 100755 --- a/install.sh +++ b/install.sh @@ -1,28 +1,45 @@ #!/bin/bash -if [ -f $HOME/.vimrc ] -then - echo "Already have a local vimrc, abort." - exit 1 -fi +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -if [ ! -f $HOME/.vim/vimrc ] -then - echo "Vimconfig rc not found, abort." - exit 2 -fi +confirm () { + # call with a prompt string or use a default + read -r -p "${1:-Are you sure? [y/N]} " response + case $response in + [yY][eE][sS]|[yY]) + true + ;; + *) + false + ;; + esac +} +confirmAndLink() { + if [ -e $2 ] + then + echo "Destination $2 already exists and will be overwritten." + confirm && rm -rf $2 && ln -s $1 $2 + else + ln -s $1 $2 + fi +} + +cd $DIR && echo "Current working directory is ${DIR}" echo -n "Downloading dependencies... " -cd $HOME/.vim git submodule init &> /dev/null && git submodule update &> /dev/null \ || $(echo "Failed."; echo "Submodule installation failed."; exit 3) -echo "Done." +echo "done." + +# Install vim + +echo "Installing vim." + +confirmAndLink $DIR/vim/vimrc $HOME/.vimrc +confirmAndLink $DIR/vim $HOME/.vim -echo "Installing .vimrc" -ln -s $HOME/.vim/vimrc $HOME/.vimrc -echo echo "Installation finished." diff --git a/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim similarity index 100% rename from after/ftplugin/php.vim rename to vim/after/ftplugin/php.vim diff --git a/after/ftplugin/smarty.vim b/vim/after/ftplugin/smarty.vim similarity index 100% rename from after/ftplugin/smarty.vim rename to vim/after/ftplugin/smarty.vim diff --git a/autoload/pathogen.vim b/vim/autoload/pathogen.vim similarity index 100% rename from autoload/pathogen.vim rename to vim/autoload/pathogen.vim diff --git a/bundle/molokai b/vim/bundle/molokai similarity index 100% rename from bundle/molokai rename to vim/bundle/molokai diff --git a/bundle/syntastic b/vim/bundle/syntastic similarity index 100% rename from bundle/syntastic rename to vim/bundle/syntastic diff --git a/bundle/vim-javascript b/vim/bundle/vim-javascript similarity index 100% rename from bundle/vim-javascript rename to vim/bundle/vim-javascript diff --git a/bundle/vim-latex b/vim/bundle/vim-latex similarity index 100% rename from bundle/vim-latex rename to vim/bundle/vim-latex diff --git a/bundle/vim-less b/vim/bundle/vim-less similarity index 100% rename from bundle/vim-less rename to vim/bundle/vim-less diff --git a/bundle/vim-markdown b/vim/bundle/vim-markdown similarity index 100% rename from bundle/vim-markdown rename to vim/bundle/vim-markdown diff --git a/bundle/vim-vimlint b/vim/bundle/vim-vimlint similarity index 100% rename from bundle/vim-vimlint rename to vim/bundle/vim-vimlint diff --git a/bundle/vim-vimlparser b/vim/bundle/vim-vimlparser similarity index 100% rename from bundle/vim-vimlparser rename to vim/bundle/vim-vimlparser diff --git a/pathogen b/vim/pathogen similarity index 100% rename from pathogen rename to vim/pathogen diff --git a/vimrc b/vim/vimrc similarity index 100% rename from vimrc rename to vim/vimrc