1
0

install.sh 685 B

12345678910111213141516171819202122232425262728293031323334
  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. if which tmux >/dev/null; then
  17. ln -sf $DIR/tmux.conf ~/.tmux.conf
  18. if [ $INSTALL_ALL -eq 1 ]; then
  19. ln -sf $DIR/tmux.clear-keys.conf ~/.tmux.clear-keys.conf
  20. fi
  21. fi
  22. # vim
  23. if which vim >/dev/null; then
  24. ln -sfT $DIR/vim ~/.vim
  25. ln -sf $DIR/vimrc ~/.vimrc
  26. vim +PluginClean! +PluginInstall +qall
  27. fi