Skip to content

Instantly share code, notes, and snippets.

@rabdill
Created January 15, 2021 17:02
Show Gist options
  • Save rabdill/0e165ce447f25bd028caead8f34b346e to your computer and use it in GitHub Desktop.
Save rabdill/0e165ce447f25bd028caead8f34b346e to your computer and use it in GitHub Desktop.
Personal theme for the ZSH shell
# - Loadable by the "Oh My Zsh" tool: https://github.com/ohmyzsh/ohmyzsh
# - A fork of the "robbyrussell" theme
# - Customized with much help from https://scriptingosx.com/2019/07/moving-to-zsh-06-customizing-the-zsh-prompt/
unsetopt nomatch # to prevent weird string comparison/globbing problems with ohmyzsh
setopt AUTO_CD # typing path will cd there
# turn on history
HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
setopt EXTENDED_HISTORY # for timestamps, elapsed time, etc
setopt SHARE_HISTORY # share history across sessions
setopt APPEND_HISTORY # don't overwrite history files
setopt HIST_EXPIRE_DUPS_FIRST # clean out duplicate commands preferentially
setopt HIST_IGNORE_DUPS # don't write dups to file
setopt HIST_FIND_NO_DUPS # only show 1 copy of a command when searching
setopt HIST_REDUCE_BLANKS # get rid of blank lines from history
setopt HIST_VERIFY # when using '!!', require hitting enter twice
### BUILD THE PROMPT
# start with the exit status of the previous command
PROMPT='%(?.%F{green}√.%F{red}?%?)%f '
# then change the color to gray
PROMPT+='%F{109}'
# add the time
#PROMPT+='%* '
# then the two closest directories
PROMPT+='%B%2~%f%b'
# then git info, if we're in a repo
PROMPT+=' $(git_prompt_info)'
# finish it off with a % prompt, or a > if privileged
PROMPT+='%F{109}%(!.#.>)%f '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment