Thanks for a really powerful theme, especially the fast git functionality! 🥇
Is it possible to have a dedicated vcs state for a git repository containing conflicts, so the background can be colored differently?
According to https://github.com/romkatv/powerlevel10k/blob/master/EXTENDED_CONFIGURATION.md:
When using gitstatus, components of vcs segment can be colored individually by setting POWERLEVEL9K_VCS_${STATE}_${COMPONENT}FORMAT_FOREGROUND. ${STATE} should be one of CLEAN, UNTRACKED, MODIFIED or LOADING.
So, IIUC, a repository in a merge state with conflicts is considered 'clean', and the clean background color is applied. (at least that is the behavior I am seeing)

Is it possible to have an extra state for conflicts, so that a different background color can be applied? Or alternatively, when there are conflicts have the 'dirty' background applied?
You can see my config here: https://github.com/lucascosti/zshrc/blob/420d53a0f884079f2f29617b6941977f03883b71/zshscripts/themes/p10k-lucas.zsh
This is done. From https://github.com/romkatv/powerlevel10k/commit/80d9df711707c827e50a7f6f85924f3ddf2407b8:
add
CONFLICTINGstate to vcsThe new state is used whenever there is at least one conflicting change. It is disabled by default. It can be enabled by defining
POWERLEVEL9K_VCS_CONFLICTING_STATE=true.POWERLEVEL9K_VCS_CONFLICTING_STATE=true POWERLEVEL9K_VCS_CONFLICTING_BACKGROUND=magenta
@romkatv Thanks a lot for looking into this, but after rebasing and adding these settings, for repos with conflicts, the git segment of the prompt now fails to appear (non-conflicting repos are fine).
Any suggestions for me to troubleshoot?
❯ echo $VCS_STATUS_HAS_CONFLICTED
1
❯ echo $_POWERLEVEL9K_VCS_CONFLICTING_STATE
1
This is because you have POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true and empty POWERLEVEL9K_VCS_CONFLICTING_CONTENT_EXPANSION. The easiest fix is to replace this line:
typeset -g POWERLEVEL9K_VCS_{CLEAN,UNTRACKED,MODIFIED}_CONTENT_EXPANSION=$vcs
With this:
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION=$vcs
By the way, your config contains a lot of redundant and confusing options. Also, most comments are now misleading. As far as I can tell, your config is equivalent to this (much shorter) config:
() {
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status time dir vcs newline prompt_char)
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
typeset -g POWERLEVEL9K_MODE=nerdfont-complete
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
typeset -g POWERLEVEL9K_SHOW_RULER=true
typeset -g POWERLEVEL9K_RULER_CHAR='─'
typeset -g POWERLEVEL9K_RULER_FOREGROUND=240
typeset -g POWERLEVEL9K_TIME_FOREGROUND=0
typeset -g POWERLEVEL9K_TIME_BACKGROUND=7
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M}'
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=true
typeset -g POWERLEVEL9K_PROMPT_CHAR_FOREGROUND=76
typeset -g POWERLEVEL9K_PROMPT_CHAR_BACKGROUND=
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_{LEFT,RIGHT}_WHITESPACE=''
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯'
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮'
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='Ⅴ'
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_SEGMENT_SEPARATOR=''
typeset -g POWERLEVEL9K_DIR_FOREGROUND=247
typeset -g POWERLEVEL9K_DIR_BACKGROUND=4
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
typeset -g POWERLEVEL9K_DIR_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER// }'
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_absolute_chars
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=40
typeset -g POWERLEVEL9K_VCS_LOADING_FOREGROUND=254
typeset -g POWERLEVEL9K_VCS_LOADING_BACKGROUND=8
typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=254
typeset -g POWERLEVEL9K_VCS_CLEAN_BACKGROUND=28
typeset -g POWERLEVEL9K_VCS_{MODIFIED,UNTRACKED}_FOREGROUND=0
typeset -g POWERLEVEL9K_VCS_{MODIFIED,UNTRACKED}_BACKGROUND=3
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=' '
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON=''
typeset -g POWERLEVEL9K_VCS_MODIFIED_ICON=''
typeset -g POWERLEVEL9K_VCS_STASH_ICON=''
typeset -g POWERLEVEL9K_VCS_CONFLICT_ICON=''
typeset -g POWERLEVEL9K_VCS_STAGED_ICON=''
local vcs=''
vcs+='${${VCS_STATUS_LOCAL_BRANCH:+${POWERLEVEL9K_VCS_BRANCH_ICON}${VCS_STATUS_LOCAL_BRANCH//\%/%%}}'
vcs+=':-@${VCS_STATUS_COMMIT[1,8]}}'
vcs+='${${VCS_STATUS_REMOTE_BRANCH:#($VCS_STATUS_LOCAL_BRANCH|master)}:+:${VCS_STATUS_REMOTE_BRANCH//\%/%%}}'
vcs+='${VCS_STATUS_TAG:+%f#${VCS_STATUS_TAG//\%/%%}}'
vcs+=' '
vcs+='${${VCS_STATUS_COMMITS_BEHIND:#0}:+⇣${VCS_STATUS_COMMITS_BEHIND}${${VCS_STATUS_COMMITS_AHEAD:#<1->}:+ }}'
vcs+='${${VCS_STATUS_COMMITS_AHEAD:#0}:+${${(M)VCS_STATUS_COMMITS_BEHIND:#0}:+}⇡${VCS_STATUS_COMMITS_AHEAD} }'
vcs+='${${VCS_STATUS_STASHES:#0}:+%025F${POWERLEVEL9K_VCS_STASH_ICON}${VCS_STATUS_STASHES} }'
vcs+='${VCS_STATUS_ACTION:+%001F${VCS_STATUS_ACTION//\%/%%} }'
vcs+='${${VCS_STATUS_NUM_CONFLICTED:#0}:+%001F${POWERLEVEL9K_VCS_CONFLICT_ICON}${VCS_STATUS_NUM_CONFLICTED}}'
vcs+='${${VCS_STATUS_NUM_STAGED:#0}:+%021F${POWERLEVEL9K_VCS_STAGED_ICON}${VCS_STATUS_NUM_STAGED}}'
vcs+='${${VCS_STATUS_NUM_UNSTAGED:#0}:+%124F${POWERLEVEL9K_VCS_MODIFIED_ICON}${VCS_STATUS_NUM_UNSTAGED}}'
vcs+='${${VCS_STATUS_NUM_UNTRACKED:#0}:+%008F${POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}}'
vcs="\${P9K_CONTENT:-$vcs}"
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION=$vcs
typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION=${${${vcs//\%f}//\%<->F}//\%F\{(\#|)[[:xdigit:]]#(\\|)\}}
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1
typeset -g POWERLEVEL9K_STATUS_OK=false
typeset -g POWERLEVEL9K_STATUS_ERROR=true
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=255
typeset -g POWERLEVEL9K_STATUS_ERROR_BACKGROUND=1
typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘'
typeset -g POWERLEVEL9K_STATUS_VERBOSE=false
}
Some of the things in vcs look odd. For example, ${${(M)VCS_STATUS_COMMITS_BEHIND:#0}:+} is always an empty string. I kept those as is.
P.S.
The default config (especially lean style) is very good. I understand that you are trying to recreate the prompt you had in bash, and it's fine, but if you find yourself in a position where you feel like trying something new, give it a try.
This is because you have POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true and empty POWERLEVEL9K_VCS_CONFLICTING_CONTENT_EXPANSION. The easiest fix is to replace this line:
Thank a bunch, that was it! (I missed that change in the earlier commit... 😕)
By the way, your config contains a lot of redundant and confusing options. Also, most comments are now misleading.
haha, yes, I definitely know. I started out just hacking away at the lean config, and I have been meaning to go through it and clean it. The vcs stuff was definitely me stabbing in the dark until I got something that worked 😊
As far as I can tell, your config is equivalent to this (much shorter) config:
You didn't need to do this for me, but thank you so much! 🚀
@lucascosti Heads up: I've renamed CONFCLICTING to CONFCLITED both in the new parameter name and the state. This is for consistency with other states and parameters. Please update powerlevel10k and your config.
Most helpful comment
This is because you have
POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=trueand emptyPOWERLEVEL9K_VCS_CONFLICTING_CONTENT_EXPANSION. The easiest fix is to replace this line:With this:
By the way, your config contains a lot of redundant and confusing options. Also, most comments are now misleading. As far as I can tell, your config is equivalent to this (much shorter) config:
Some of the things in
vcslook odd. For example,${${(M)VCS_STATUS_COMMITS_BEHIND:#0}:+}is always an empty string. I kept those as is.P.S.
The default config (especially lean style) is very good. I understand that you are trying to recreate the prompt you had in bash, and it's fine, but if you find yourself in a position where you feel like trying something new, give it a try.