forked from lewagon/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·64 lines (56 loc) · 2.11 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
backup() {
target=$1
if [ -e "$target" ]; then # Does the config file already exist?
if [ ! -L "$target" ]; then # as a pure file?
mv "$target" "$target.backup" # Then backup it
echo "-----> Moved your old $target config file to $target.backup"
fi
fi
}
#!/bin/zsh
for name in *; do
if [ ! -d "$name" ]; then
target="$HOME/.$name"
if [[ ! "$name" =~ '\.sh$' ]] && [ "$name" != 'README.md' ]; then
backup $target
if [ ! -e "$target" ]; then
echo "-----> Symlinking your new $target"
ln -s "$PWD/$name" "$target"
fi
fi
fi
done
REGULAR="\\033[0;39m"
YELLOW="\\033[1;33m"
GREEN="\\033[1;32m"
# zsh plugins
CURRENT_DIR=`pwd`
ZSH_PLUGINS_DIR="$HOME/.oh-my-zsh/custom/plugins"
mkdir -p "$ZSH_PLUGINS_DIR" && cd "$ZSH_PLUGINS_DIR"
if [ ! -d "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting" ]; then
echo "-----> Installing zsh plugin 'zsh-syntax-highlighting'..."
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
fi
cd "$CURRENT_DIR"
setopt nocasematch
if [[ ! `uname` =~ "darwin" ]]; then
git config --global core.editor "subl -n -w $@ >/dev/null 2>&1"
echo 'export BUNDLER_EDITOR="subl $@ >/dev/null 2>&1"' >> zshrc
else
git config --global core.editor "'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' -n -w"
bundler_editor="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'"
echo "export BUNDLER_EDITOR=\"${bundler_editor}\"" >> zshrc
fi
# Sublime Text
if [[ ! `uname` =~ "darwin" ]]; then
SUBL_PATH=~/.config/sublime-text-3
else
SUBL_PATH=~/Library/Application\ Support/Sublime\ Text\ 3
fi
mkdir -p $SUBL_PATH/Packages/User $SUBL_PATH/Installed\ Packages
backup "$SUBL_PATH/Packages/User/Preferences.sublime-settings"
curl -k https://sublime.wbond.net/Package%20Control.sublime-package > $SUBL_PATH/Installed\ Packages/Package\ Control.sublime-package
ln -s $PWD/Preferences.sublime-settings $SUBL_PATH/Packages/User/Preferences.sublime-settings
ln -s $PWD/Package\ Control.sublime-settings $SUBL_PATH/Packages/User/Package\ Control.sublime-settings
zsh ~/.zshrc
echo "👌 Carry on with git setup!"