Skip to content

Commit 0dc4ef5

Browse files
authored
chore: add script to install zsh for devbox (#439)
1 parent c101986 commit 0dc4ef5

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

tools/install_zsh.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#/usr/bin/env sh
2+
# This script installs zsh and oh-my-zsh, and sets up the powerlevel10k theme
3+
# and some plugins. It also modifies the ~/.zshrc file to use the powerlevel10k theme
4+
# and adds some key bindings for zsh-autosuggestions.
5+
# Usage: curl -fsSL https://raw.githubusercontent.com/vectorch-ai/ScaleLLM/main/tools/install_zsh.sh | sh
6+
7+
GREEN=$(echo -en '\033[00;32m')
8+
RESTORE=$(echo -en '\033[0m')
9+
10+
echo "Installing zsh"
11+
sudo apt install -y zsh
12+
echo "zsh is now installed"
13+
14+
echo "Installing oh-my-zsh"
15+
curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh
16+
17+
echo "Installing powerlevel10k theme"
18+
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
19+
echo "Theme powerlevel10k installed"
20+
21+
echo "Modifying ~/.zshrc to use powerlevel10k"
22+
sed -i 's+ZSH_THEME="robbyrussell"+ZSH_THEME="powerlevel10k/powerlevel10k"+' ~/.zshrc
23+
24+
echo "Continuing with plugins"
25+
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
26+
echo "Plugin zsh-autosuggestions installed"
27+
28+
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
29+
echo "Plugin zsh-syntax-highlighting installed"
30+
31+
git clone https://github.com/MichaelAquilina/zsh-you-should-use.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/you-should-use
32+
echo "Plugin you-should-use installed"
33+
34+
echo "Add the plugins to the plugins array in ~/.zshrc"
35+
sed -i "s+plugins=(git+plugins=(git zsh-autosuggestions zsh-syntax-highlighting you-should-use npm kubectl web-search copyfile+" ~/.zshrc
36+
37+
echo "Adding key bindings to ~/.zshrc"
38+
cat <<EOT >> ~/.zshrc
39+
# Key bindings for zsh-autosuggestions
40+
bindkey '^I' complete-word # tab | complete
41+
bindkey '^[[Z' autosuggest-accept # shift + tab | autosuggest
42+
EOT
43+
44+
echo "Changing default shell to zsh"
45+
sudo chsh -s $(which zsh) $(whoami)
46+
47+
exec zsh
48+
# the powerlevel10k config should launch at this point.
49+
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.

0 commit comments

Comments
 (0)