# THIS IS CURRENTLY EXPERIMENTAL. REVIEW AND TEST FIRST. NEVER RUN ON MAIN # MACHINE WITHOUT A BACKUP OF VIMFILES AND DOTFILES # Links configuration files to the ones listed here. Backup and remove your's # and then run this script while inside repo directory. # # In Windows it has to be run with git-bash. # # Note: This solution is lazy and causes some problems. Like not being able to # track vim pluggins. # Config # ====== mode=$1 # copy,slink # Prepare # ======= # HOME variable must be available if [[ -z $XDG_CONFIG_HOME ]]; then XDG_CONFIG_HOME="$HOME/.config" mkdir -p $XDG_CONFIG_HOME fi 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 VIMFILES="$HOME/.vim" # In windows it's `%userprofile%/vimfiles/` # Install # ======= # bash (`eval` concatenates and executes) 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`. Remove the former if it exists 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" # git [ -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 echo "all done :)"