Last active
April 3, 2024 07:41
-
-
Save lvaylet/52f6ddfb5ea279a3c38f04c6f942e408 to your computer and use it in GitHub Desktop.
Install a new Zsh shell with prompt, plugins, utils and custom aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Install Zsh shell and shell utils | |
sudo apt update -y && sudo apt install -y exa bat zsh | |
# Install Oh My Zsh | |
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
# Install and enable Spaceship prompt | |
git clone https://github.com/spaceship-prompt/spaceship-prompt.git "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship-prompt" --depth=1 | |
ln -s "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship-prompt/spaceship.zsh-theme" "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship.zsh-theme" | |
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="spaceship"/g' $HOME/.zshrc | |
# Create custom aliases | |
cat > ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/aliases.zsh << EOF | |
alias cat='batcat' | |
alias ls='exa' | |
EOF | |
# Install and enable ZSH plugins | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/g' $HOME/.zshrc | |
# Apply modifications | |
source $HOME/.zshrc | |
# Configure git | |
cat > $HOME/.gitconfig << EOF | |
[user] | |
name = Laurent VAYLET | |
email = [email protected] | |
[pull] | |
rebase = true | |
[fetch] | |
prune = true | |
[diff] | |
colorMoved = zebra | |
[init] | |
defaultBranch = main | |
EOF | |
# [OPTIONAL] Install Google Cloud CLI | |
sudo apt install -y apt-transport-https ca-certificates gnupg | |
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | |
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - | |
sudo apt update -y && sudo apt install -y google-cloud-cli | |
gcloud init | |
# References: | |
# - https://the.exa.website/ | |
# - https://github.com/sharkdp/bat#installation | |
# - https://ohmyz.sh/#install | |
# - https://spaceship-prompt.sh/getting-started/#installing | |
# - https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh | |
# - https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md | |
# - https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/ | |
# - https://cloud.google.com/sdk/docs/install#deb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment