-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_zsh.zsh
executable file
·48 lines (38 loc) · 1.46 KB
/
setup_zsh.zsh
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
#!/usr/bin/env zsh
echo "\n<<< Starting ZSH Setup >>>\n"
# https://stackoverflow.com/a/4749368/1341838
if grep -Fxq '/usr/local/bin/zsh' '/etc/shells'; then
echo '/usr/local/bin/zsh already exists in /etc/shells'
else
echo "Enter superuser (sudo) password to edit /etc/shells"
echo '/usr/local/bin/zsh' | sudo tee -a '/etc/shells' >/dev/null
fi
if [ "$SHELL" = '/usr/local/bin/zsh' ]; then
echo '$SHELL is already /usr/local/bin/zsh'
else
echo "Enter user password to change login shell"
chsh -s '/usr/local/bin/zsh'
fi
if sh --version | grep -q zsh; then
echo '/private/var/select/sh already linked to /bin/zsh'
else
echo "Enter superuser (sudo) password to symlink sh to zsh"
# Looked cute, might delete later, idk
sudo ln -sfv /bin/zsh /private/var/select/sh
# I'd like for this to work instead.
# sudo ln -sfv /usr/local/bin/zsh /private/var/select/sh
fi
# Installing ohmyzsh
# TODO checking ohmyzsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Clone zsh plugins
CURRENT_DIR=`pwd`
ZSH_PLUGINS_DIR="$HOME/.oh-my-zsh/custom/plugins"
# Make a folder zsh plugins
mkdir -p "$ZSH_PLUGINS_DIR" && cd "$ZSH_PLUGINS_DIR"
# Checking plugins
if [ ! -d "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting" ]; then
echo "-----> Installing zsh plugin 'zsh-autosuggestions' 'zsh-syntax-highlighting'"
git clone https://github.com/zsh-users/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting
fi