install.sh 635 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. INSTALL_ALL=0
  4. if [ "${1:-}" = "-a" ]; then INSTALL_ALL=1; fi
  5. DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  6. if ! which git >/dev/null; then
  7. echo "Error: git is not installed"
  8. exit 1
  9. fi
  10. # git
  11. git -C $DIR submodule update --init
  12. ln -sf $DIR/gitconfig ~/.gitconfig
  13. # bash
  14. ln -sf $DIR/bashrc ~/.bashrc
  15. # tmux
  16. ln -sf $DIR/tmux.conf ~/.tmux.conf
  17. if [ $INSTALL_ALL -eq 1 ]; then
  18. ln -sf $DIR/tmux.clear-keys.conf ~/.tmux.clear-keys.conf
  19. fi
  20. # vim
  21. if which vim >/dev/null; then
  22. ln -sfT $DIR/vim ~/.vim
  23. ln -sf $DIR/vimrc ~/.vimrc
  24. vim +PluginClean! +PluginInstall +qall
  25. fi