makedots.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/bash -e
  2. DIR=$(pwd)
  3. #while getopts "ozgt:" opt; do
  4. while getopts "ozt:" opt; do
  5. case "$opt" in
  6. o) CONFIG="OHMYZSH"
  7. ;;
  8. z) CONFIG="ZSH"
  9. ;;
  10. # g) CONFIG="GRML"
  11. # ;;
  12. t) TEMPLATE=$OPTARG
  13. esac
  14. done
  15. if [ ! $CONFIG ]
  16. then
  17. echo "Please specify -o or -z for oh-my-zsh or standard zsh config."
  18. exit
  19. fi
  20. if [ ! $TEMPLATE ]
  21. then
  22. echo "Pleas specify -t [template suffix]. for a local zsh config."
  23. exit
  24. fi
  25. # Template
  26. if [ -f $HOME/.zshrc.local -o -h $HOME/.zshrc.local -o -d $HOME/.zshrc.local ]
  27. then
  28. rm -i $HOME/.zshrc.local
  29. fi
  30. ln -s $DIR/zshrc.local.$TEMPLATE $HOME/.zshrc.local
  31. if [ $CONFIG == "OHMYZSH" ]
  32. then
  33. for i in zshrc oh.my.zsh zshrc.mine
  34. do
  35. if [ -f $HOME/.$i -o -h $HOME/.$i -o -d $HOME/.$i ]
  36. then
  37. rm -ri $HOME/.$i
  38. fi
  39. done
  40. ln -s $DIR/zshrc.oh.my.zsh $HOME/.zshrc
  41. ln -s $DIR/zshrc $HOME/.zshrc.mine
  42. ln -s $DIR/oh-my-zsh $HOME/.oh-my-zsh
  43. fi
  44. if [ $CONFIG == "ZSH" ]
  45. then
  46. for i in zshrc zsh
  47. do
  48. if [ -f $HOME/.$i -o -h $HOME/.$i -o -d $HOME/.$i ]
  49. then
  50. rm -ri $HOME/.$i
  51. fi
  52. ln -s $DIR/$i $HOME/.$i
  53. done
  54. fi
  55. for i in vimrc vim bashrc tmux.conf
  56. do
  57. if [ -f $HOME/.$i -o -h $HOME/.$i -o -d $HOME/.$i ]
  58. then
  59. rm -ri $HOME/.$i
  60. fi
  61. ln -s $DIR/$i $HOME/.$i
  62. done
  63. mkdir -p .config/
  64. if [ -d .config/nvim ]
  65. then
  66. rm -ri .config/nvim
  67. fi
  68. ln -s $DIR/vim $HOME/.config/nvim