Fix jj/vcs status in p10k

This commit is contained in:
2026-04-17 10:42:24 -07:00
parent 4c641c4435
commit 1e9825c02e
4 changed files with 16 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
# Dotfiles
# Install
## Install
## Common dependencies
### Arch
```sh

View File

@@ -1,2 +0,0 @@
/home/chun/dotfiles/.jj/repo

View File

@@ -4,7 +4,7 @@ include current-theme.conf
# END_KITTY_THEME
# Font
font_family JetBrains Mono Light
font_family JetBrainsMono NF Light
font_size 11.0
# Cursor

View File

@@ -33,7 +33,8 @@
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
# os_icon # os identifier
dir # current directory
jj # jujutsu status
jj # jujutsu status (hides vcs in jj repos)
vcs # git status (shown in non-jj repos only)
# prompt_char # prompt symbol
)
@@ -1766,11 +1767,19 @@
# Jujutsu (jj) prompt segment
function prompt_jj() {
# Only show in jj repos
local jj_root
jj_root=$(jj root 2>/dev/null) || return
jj_root=$(jj root 2>/dev/null)
# Get current change info: change_id (short), bookmarks, description, conflict/divergent flags
if [[ -z $jj_root ]]; then
# Not a jj repo — let vcs segment handle git display
p10k display '*/vcs=show'
return
fi
# In a jj repo — hide vcs (would show unhelpful "detached HEAD" for jj-backed-git)
p10k display '*/vcs=hide'
# Get current change info: change_id (short), bookmarks, conflict/divergent/empty flags
local info
info=$(jj log -r @ --no-graph -T '
separate(" ",