Skip to content

Commit

Permalink
Update qoomon.zsh-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
qoomon authored Apr 29, 2022
1 parent 4c030c7 commit c6be782
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions qoomon.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ PROMPT_INFO_USER='true'
PROMPT_INFO_HOST='true'
PROMPT_INFO_GIT='true'

PROMPT_INFO_INDICATOR='#'
PROMPT_INFO_SEPERATOR=''
PROMPT_INFO_INDICATOR='╭─'
PROMPT_INFO_SEPERATOR='' # • (bold)
PROMPT_INFO_GIT_DIRTY_INDICATOR='*'
PROMPT_PRIMARY_INDICATOR=''
PROMPT_SECONDARY_INDICATOR=''

PROMPT_PRIMARY_INDICATOR='╰─➜ ' #
PROMPT_SECONDARY_INDICATOR=''
PROMPT_ERROR_INDICATOR='' # ✖ (bold)

###### Prompt Configuration ####################################################

#0.270
function _prompt_print_info {
setopt local_options extended_glob

Expand All @@ -27,7 +26,7 @@ function _prompt_print_info {
then
local user_name=$USER
if [ $EUID = 0 ] # highlight root user
then
then
prompt_info+=" ${fg_bold[red]}${user_name}${reset_color}"
else
prompt_info+=" ${fg[cyan]}${user_name}${reset_color}"
Expand All @@ -54,11 +53,11 @@ function _prompt_print_info {
prompt_info+=" ${fg_bold[grey]}${PROMPT_INFO_SEPERATOR}${reset_color} ${fg[yellow]}${working_dir}${reset_color}"

# --- git info
if [[ $PROMPT_INFO_GIT == 'true' ]] && [[ $commands[git] ]] &&
if [[ $PROMPT_INFO_GIT == 'true' ]] && [[ $commands[git] ]] &&
[[ $(git rev-parse --is-inside-work-tree 2> /dev/null || echo false) != 'false' ]]
then
prompt_info+=" ${fg_bold[grey]}${PROMPT_INFO_SEPERATOR}${reset_color}"

# branch name
local branch=$(git branch --show-current HEAD)
local ref_name=$branch
Expand All @@ -72,10 +71,10 @@ function _prompt_print_info {
then
# commit hash
ref_name=$(git rev-parse --short HEAD)
fi
fi
fi
prompt_info+=" ${fg[green]}${ref_name}${reset_color}"

# dirty indicator
local dirty
if ! (git diff --exit-code --quiet && git diff --cached --exit-code --quiet)
Expand All @@ -90,13 +89,13 @@ function _prompt_print_info {
fi
else # skip check for large repositories
dirty='?'
fi
fi
fi
if [[ $dirty ]]
then
prompt_info+="${fg_bold[magenta]}${dirty}${reset_color}"
fi

# commits ahead and behind
if [[ $branch ]]
then
Expand All @@ -122,8 +121,8 @@ function _prompt_print_info {

precmd_functions=($precmd_functions _prompt_print_info)

PS1="${PROMPT_PRIMARY_INDICATOR} "
PS2="${PROMPT_SECONDARY_INDICATOR} "
PS1="%{${fg_bold[grey]}%}${PROMPT_PRIMARY_INDICATOR}%{${reset_color}%}"
PS2="%{${fg_bold[grey]}%}${PROMPT_SECONDARY_INDICATOR}%{${reset_color}%}"

###### Handle Exit Codes #######################################################

Expand All @@ -143,11 +142,11 @@ function _prompt_print_status {
then
return
fi

if [[ $exec_status != 0 ]]
then
printf '\033[2K\r' # clear line; prevents strange line wrap behaviour when resizing terminal window
printf "${fg_bold[red]} ${exec_status}${reset_color}\n"
printf "${fg_bold[red]}${PROMPT_ERROR_INDICATOR} ${exec_status}${reset_color}\n"
fi
}
precmd_functions=(_prompt_print_status $precmd_functions)
Expand All @@ -163,7 +162,7 @@ function _promp_handle_interupt {
then
printf '\n'
printf '\033[2K\r' #clear line
printf "${fg_bold[grey]} 130${reset_color}"
printf "${fg_bold[grey]}${} 130${reset_color}"
fi
}
trap "_promp_handle_interupt; return 130" INT
Expand Down

0 comments on commit c6be782

Please sign in to comment.