From 1c65bc1f98bedacaa40cad62d50bad3af1dbc2f1 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Fri, 5 Jun 2015 15:34:27 +0100 Subject: updated install script --- .gitmodules | 3 ++ gitconfig | 6 +++ install.sh | 146 +++++++++++++++++++++++++++++++++++------------------------- nvimrc | 2 +- 4 files changed, 95 insertions(+), 62 deletions(-) create mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5438b05 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "fuzzy-zsh-marks"] + path = fuzzy-zsh-marks + url = git@github.com:uvaes/fuzzy-zsh-marks diff --git a/gitconfig b/gitconfig index f1fffcd..5afe4c8 100644 --- a/gitconfig +++ b/gitconfig @@ -7,3 +7,9 @@ ctags = !.git/hooks/ctags [push] default = simple +[status] + submodulesummary = 1 +[alias] + sdiff = !git diff && git submodule foreach 'git diff' + spush = push --recurse-submodules=on-demand + supdate = submodule update --remote --merge diff --git a/install.sh b/install.sh index 24259b3..f679a42 100755 --- a/install.sh +++ b/install.sh @@ -1,78 +1,102 @@ #!/bin/bash +home=/home/urbain dir=~/dotfiles olddir=~/dotfiles_old -home=/home/urbain -rm -rf $olddir -mkdir -p $olddir +install_dotfiles=0 +install_repos=0 +install_aux=0 + +while [[ $# > 0 ]] +do + key="$1" + echo $key + case $key in + -d|--dotfiles) + install_dotfiles=1 + ;; + -r|--repositories) + install_repos=1 + ;; + -l|--lib) + install_aux=1 + ;; + *) + ;; + esac + shift +done + +if [[ "$install_dotfiles" -eq "1" ]]; then + + echo -e "\n*** Installing dotfiles ***" -echo -e "\n*** Symlinking files *** \n" -if [ $# -eq 0 ]; then + rm -rf $olddir + mkdir -p $olddir + listFiles=`ls --ignore="make" --ignore="tex" --ignore="README.md"` -else - listFiles=$@ -fi -cd $dir -for file in $listFiles; do - if [ -e ~/.$file ]; then - mv ~/.$file $olddir - printf '~/.%-15s exists. ' $file - echo -n "Moving it to $olddir. " - fi - ln -s $dir/$file ~/.$file - echo "(Re)-creating symbolic link of $file." -done + cd $dir + for file in $listFiles; do + if [ -e ~/.$file ]; then + mv ~/.$file $olddir + printf '~/.%-15s exists. ' $file + echo -n "Moving it to $olddir. " + fi + ln -s $dir/$file ~/.$file + echo "(Re)-creating symbolic link of $file." + done -if [ $# -ne 0 ]; then - exit + cd $dir + mkdir -p nvim/vimundo + mkdir -p mutt/temp + mkdir -p mutt/cache + mkdir -p mutt/cache/bodies fi -# Symlink for neovim -# rm ~/.nvim ~/.nvimrc -# ln -s $dir/vim ~/.nvim -# ln -s $dir/vimrc ~/.nvimrc - -echo -e "\n*** Updating/Creating git repositories *** \n" - -declare -A repos -repos[altercation]=$home/.solarized/mutt-colors-solarized -repos[Anthony25]=$home/.solarized/gnome-terminal-colors-solarized -repos[seebi]=$home/.solarized/dircolors-solarized -repos[gmarik]=$home/.vim/bundle/vundle -repos[junegunn]=$home/.nvim/vim-plug -repos[tmux-plugins]=$home/.tmux/plugins/tpm - -for author in "${!repos[@]}"; do - thisDir=${repos[$author]} - if [ ! -d $thisDir ]; then - parentDir=`echo $thisDir | sed 's/\/[^\/]\+$//g'` - githubDir=https://github.com/$author`echo $thisDir | sed 's/.*\(\/[^\/]\+\)$/\1/g'` - echo $githubDir - mkdir -p $parentDir; cd $parentDir - git clone $githubDir - else - cd $thisDir - git pull origin master +if [[ "$install_repos" -eq "1" ]]; then + echo -e "\n *** Updating/Creating git repositories ***" + + declare -A repos + repos[altercation]=$home/.solarized/mutt-colors-solarized + repos[Anthony25]=$home/.solarized/gnome-terminal-colors-solarized + repos[seebi]=$home/.solarized/dircolors-solarized + repos[gmarik]=$home/.vim/bundle/vundle + repos[junegunn]=$home/.nvim/vim-plug + repos[tmux-plugins]=$home/.tmux/plugins/tpm + repos[uvaes]=$home/git/fuzzy-zsh-marks + repos[alols]=$home/xcape + + for author in "${!repos[@]}"; do + thisDir=${repos[$author]} + if [ ! -d $thisDir ]; then + parentDir=`echo $thisDir | sed 's/\/[^\/]\+$//g'` + githubDir=https://github.com/$author`echo $thisDir | sed 's/.*\(\/[^\/]\+\)$/\1/g'` + mkdir -p $parentDir; cd $parentDir + echo "Cloning $githubDir in $parentDir..." + git clone -q $githubDir >> /dev/null + else + cd $thisDir + echo "Updating git repository stored in $thisDir" + git pull -q origin master >> /dev/null + cat <(git log --pretty=format:"-- %h %s (%cr)" "ORIG_HEAD...HEAD") + fi + done + + # Installing vim-plug vim package manager + cd $dir/nvim + if [ -e autoload ]; then + rm -rf autoload fi -done + mkdir -p autoload + ln -s $dir/nvim/vim-plug/plug.vim $dir/nvim/autoload/plug.vim +fi -# Installing vim-plug vim package manager -cd $dir/nvim -if [ -e autoload ]; then - rm -rf autoload +# Creating auxiliary files +if [[ "$install_aux" -eq "1" ]]; then + echo "Nothing to do for -a" fi -mkdir -p autoload -ln -s $dir/nvim/vim-plug/plug.vim $dir/nvim/autoload/plug.vim -sudo pip install neovim - -# Creating auxiliary files for mutt -cd $dir -mkdir -p nvim/vimundo -mkdir -p mutt/temp -mkdir -p mutt/cache -mkdir -p mutt/cache/bodies echo -e "\n*** Installation successful *** \n" diff --git a/nvimrc b/nvimrc index b7dcd3f..195cb6a 100644 --- a/nvimrc +++ b/nvimrc @@ -182,7 +182,7 @@ set lazyredraw set hidden " Colorscheme -silent! colo solarized +silent! colo seoul256 highlight Comment cterm=italic set t_ZH= set t_ZR=[23m -- cgit v1.2.3