Skip to content

Instantly share code, notes, and snippets.

@leoheck
Last active February 19, 2021 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leoheck/4136cd602fbece506caa43f3a2634434 to your computer and use it in GitHub Desktop.
Save leoheck/4136cd602fbece506caa43f3a2634434 to your computer and use it in GitHub Desktop.
Shell Customization
sudo apt update
sudo apt install -y zsh
sudo apt install -y git
sudo apt install -y curl
sudo apt install -y wget
sudo apt install -y binutils
# Install oh-my-zsh
if [[ ! -d ~/.oh-my-zsh ]]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else
upgrade_oh_my_zsh
fi
# Install spaceship-theme
if [[ ! -d $ZSH_CUSTOM/themes/spaceship-prompt ]]; then
git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
ln -sf "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="spaceship"/g' ~/.zshrc
fi
# Force zsh as main shell
chsh -s $(which zsh)
# Create a script to fix ZSH history
read -r -d '' FIX_ZSH_HISTORY_SCRIPT <<-EOM
mv ~/.zsh_history ~/.zsh_history_bad
strings ~/.zsh_history_bad > ~/.zsh_history
fc -R ~/.zsh_history
rm ~/.zsh_history_bad
EOM
echo ${FIX_ZSH_HISTORY_SCRIPT} > ~/fix_zsh_history
chmod +x ~/fix_zsh_history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment