diff options
Diffstat (limited to 'install.sh')
| -rwxr-xr-x[-rw-r--r--] | install.sh | 72 |
1 files changed, 44 insertions, 28 deletions
diff --git a/install.sh b/install.sh index 9fcd2fa..36c84b6 100644..100755 --- a/install.sh +++ b/install.sh @@ -10,54 +10,70 @@ # Note: This solution is lazy and causes some problems. Like not being able to # track vim pluggins. - # Config # ====== -platform="linux" # linux,windows -mode="copy" # copy,slink +mode=$1 # copy,slink + +# Prepare +# ======= -# Auto config -# =========== +# HOME variable must be available + +if [[ -z $XDG_CONFIG_HOME ]]; then + XDG_CONFIG_HOME="$HOME/.config" + mkdir -p $XDG_CONFIG_HOME +fi -# Append ~ later (bash only does 1 substitution of variables) -if [[ $platform = "linux" ]]; then - VIMFILES=".vim" -elif [[ $platform = "windows" ]]; then - VIMFILES="vimfiles" +if [[ $mode = "copy" ]]; then + cp_or_ln="cp" +elif [[ $mode = "slink" ]]; then + cp_or_ln="ln -s" # if you are fearless add the `-f` option +else + echo "Usage: $0 copy|slink" + exit fi -[[ $mode = "copy" ]] && cp_or_ln="cp" -[[ $mode = "slink" ]] && cp_or_ln="ln -s" +VIMFILES="$HOME/.vim" # In windows it's `%userprofile%/vimfiles/` -# Commands -# ======== +# Install +# ======= -# bash ( eval concatenates and executes) +# bash (`eval` concatenates and executes) -eval $cp_or_ln " ${PWD}/profile ~/.profile" -eval $cp_or_ln " ${PWD}/bash_aliases ~/.bash_aliases" -eval $cp_or_ln " ${PWD}/bashrc ~/.bashrc" -eval $cp_or_ln " ${PWD}/inputrc ~/.inputrc" +eval $cp_or_ln " ${PWD}/bash/profile $HOME/.profile" +eval $cp_or_ln " ${PWD}/bash/bashrc $HOME/.bashrc" +eval $cp_or_ln " ${PWD}/bash/bash_aliases $HOME/.bash_aliases" +eval $cp_or_ln " ${PWD}/bash/inputrc $HOME/.inputrc" # vim -# ~/.vimrc takes priority over ~/.vim/vimrc, so remove the former first +# `~/.vimrc` takes priority over `~/.vim/vimrc`. Remove the former if it exists -mkdir -p ~/$VIMFILES/{undo,swap,backup,plugins} -chmod 0700 ~/.vim/swap # swap files should only be readable by owner +mkdir -p $VIMFILES/{undo,swap,backup,plugins} +chmod 0700 $VIMFILES/swap # swap files should only be readable by owner -eval $cp_or_ln " ${PWD}/vim/vimrc ~/$VIMFILES/vimrc" -eval $cp_or_ln " ${PWD}/vim/fun.vim ~/$VIMFILES/fun.vim" +eval $cp_or_ln " ${PWD}/vim/vimrc $VIMFILES/vimrc" +eval $cp_or_ln " ${PWD}/vim/fun.vim $VIMFILES/fun.vim" # git -[ -d ~/.config/git ] || mkdir -p ~/.config/git -eval $cp_or_ln " ${PWD}/git/ignore ~/.config/git/ignore" -eval $cp_or_ln " ${PWD}/git/config ~/.config/git/config" -eval $cp_or_ln " ${PWD}/git/git-prompt.sh ~/.git-prompt.sh" +[ -d $XDG_CONFIG_HOME/git ] || mkdir -p $XDG_CONFIG_HOME/git +eval $cp_or_ln " ${PWD}/git/ignore $XDG_CONFIG_HOME/git/ignore" +eval $cp_or_ln " ${PWD}/git/config $XDG_CONFIG_HOME/git/config" +eval $cp_or_ln " ${PWD}/git/git-prompt.sh $HOME/.git-prompt.sh" + +# zathura + +mkdir -p $XDG_CONFIG_HOME/zathura +eval $cp_or_ln " ${PWD}/other/zathurarc $XDG_CONFIG_HOME/zathura/zathurarc" + +# tmux + +eval $cp_or_ln " ${PWD}/tmux/tmux.conf $HOME/.tmux.conf" +eval $cp_or_ln " ${PWD}/tmux/tmux.conf.local $HOME/.tmux.conf.local" # done |
