Skip to content

Instantly share code, notes, and snippets.

@gedzeppelin
Last active August 10, 2021 19:02
Show Gist options
  • Save gedzeppelin/9a69a6d1c5392619dff6097a069c3e18 to your computer and use it in GitHub Desktop.
Save gedzeppelin/9a69a6d1c5392619dff6097a069c3e18 to your computer and use it in GitHub Desktop.
Simple zsh theme.
# Functions
git_prompt_info() {
inside_git_repo="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
if [ "$inside_git_repo" ]; then
branch=$(git branch | awk '/^\*/ { print $2 }')
echo "%{$RESET%}, in %{$GREEN%}$branch%{$RESET%} branch"
else
echo ""
fi;
}
get_dir() {
if [ "$(pwd)" = "$(eval echo ~$(id -n -u))" ]; then
echo "~/"
else
echo "%3~"
fi;
}
# Colors
RESET=$(echo '\033[0m')
BLUE=$(echo '\033[1;38;5;51m')
ORANGE=$(echo '\033[1;38;5;215m')
VIOLET=$(echo '\033[1;38;5;111m')
PINK=$(echo '\033[1;38;5;218m')
GREEN=$(echo '\033[1;38;5;119m')
RED=$(echo '\033[1;38;5;9m')
# Custom prompt
PROMPT=$'%(?:%{$GREEN%}:%{$RED%})[%{$BLUE%}%T%(?:%{$GREEN%}:%{$RED%})] %(!.%{$RED%}.%{$ORANGE%})%n%{$RESET%} at %{$VIOLET%}%m$(git_prompt_info) %(?:%{$GREEN%}:%{$RED%})[%{$BLUE%}$(get_dir)%(?:%{$GREEN%}:%{$RED%})]
─▶%{$RESET%} '
#!/bin/sh
set -e
sudo apt -y update
sudo apt -y install wget git zsh
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" "" --unattended
sudo chsh -s /usr/bin/zsh $USER
wget --backups=1 https://gist.githubusercontent.com/gedzeppelin/9a69a6d1c5392619dff6097a069c3e18/raw/gdzsh.zsh-theme -P $HOME/.oh-my-zsh/custom/themes/
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="gdzsh"/' $HOME/.zshrc
exec zsh
#!/bin/sh
set -e
sudo pacman -Sy wget git zsh --noconfirm
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" "" --unattended
sudo chsh -s /usr/bin/zsh $USER
wget --backups=1 https://gist.githubusercontent.com/gedzeppelin/9a69a6d1c5392619dff6097a069c3e18/raw/gdzsh.zsh-theme -P $HOME/.oh-my-zsh/custom/themes/
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="gdzsh"/' $HOME/.zshrc
exec zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment