Last active
May 2, 2024 16:13
-
-
Save justdan96/0648d54adc02f8eb7d1282cb4ee56bea to your computer and use it in GitHub Desktop.
Personal Oh-My-Zsh Theme
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
| # Obi-w00t's theme, based on Michele Bologna's theme | |
| # https://www.michelebologna.net | |
| # | |
| # The main changes are: | |
| # * hostname is now always red | |
| # * git prompt now uses vcs_info, and has just the following prompt chars: | |
| # ~ = untracked changes | |
| # + = staged changes | |
| # * = unstaged changed | |
| # ± = local branch is behind or ahead of remote | |
| # * some small tweaks to the colours and formatting of the git prompt | |
| autoload -Uz vcs_info | |
| theme_precmd () { | |
| local prompt_head=' %F{cyan}(%F{green}%b%c%u' | |
| local prompt_char='' | |
| if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then | |
| prompt_char+='%F{magenta}~' | |
| fi | |
| if [[ ! -z $(git log --branches --not --remotes 2> /dev/null) ]]; then | |
| prompt_char+='%F{050}±' | |
| fi | |
| local prompt_foot='%F{cyan})%f' | |
| zstyle ':vcs_info:git:*' formats "${prompt_head}${prompt_char}${prompt_foot}" | |
| vcs_info | |
| } | |
| local green="%{$fg_bold[green]%}" | |
| local red="%{$fg_bold[red]%}" | |
| local cyan="%{$fg_bold[cyan]%}" | |
| local yellow="%{$fg_bold[yellow]%}" | |
| local blue="%{$fg_bold[blue]%}" | |
| local magenta="%{$fg_bold[magenta]%}" | |
| local reset="%{$reset_color%}" | |
| local username_color=$blue | |
| local hostname_color=$red | |
| local current_dir_color=$blue | |
| local username="%n" | |
| local hostname="%m" | |
| local current_dir="%~" | |
| local username_output="%(!..${username_color}${username}${reset}@)" | |
| local hostname_output="${hostname_color}${hostname}${reset}" | |
| local current_dir_output="${current_dir_color}${current_dir}${reset}" | |
| local jobs_bg="${red}fg: %j$reset" | |
| local last_command_output="%(?.%(!.$red.$green).$yellow)" | |
| zstyle ':vcs_info:*' check-for-changes true | |
| zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes | |
| zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes | |
| zstyle ':vcs_info:*' actionformats '%F{cyan}(%F{green}%b%F{3}|%F{1}%a%c%u%F{cyan})%f' | |
| zstyle ':vcs_info:*' enable git | |
| setopt prompt_subst | |
| PROMPT="$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)" | |
| PROMPT+='${vcs_info_msg_0_} ' | |
| PROMPT+="$last_command_output%#$reset " | |
| RPROMPT='' | |
| autoload -U add-zsh-hook | |
| add-zsh-hook precmd theme_precmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment