diff options
Diffstat (limited to 'zsh/functions')
| -rw-r--r-- | zsh/functions/status.zsh | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/zsh/functions/status.zsh b/zsh/functions/status.zsh index 3062ce8..f7f38ce 100644 --- a/zsh/functions/status.zsh +++ b/zsh/functions/status.zsh @@ -29,11 +29,50 @@ function node_info { echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo:-no}" } +function jj_info { + # Check if we're in a jj repo + if ! jj root &> /dev/null; then + return + fi + + # Get current change ID (short form) + change=$(jj log -r @ --no-graph -T 'change_id.shortest()' 2> /dev/null) + + if [ ! -z "$change" ]; then + echo -n "@%F{cyan}$change%f" + + # Get status output + status_output=$(jj status 2> /dev/null) + + # Modified files + if echo "$status_output" | rg -q '^M '; then + echo -n "%{%F{yellow}%}△%f" + fi + + # Added files + if echo "$status_output" | rg -q '^A '; then + echo -n "%{%F{green}%}+%f" + fi + + # Deleted files + if echo "$status_output" | rg -q '^D '; then + echo -n "%{%F{red}%}×%f" + fi + + # Unknown/untracked files + if echo "$status_output" | rg -q '^\? '; then + echo -n "%{%F{magenta}%}+%f" + fi + + echo -n "%f" + fi +} + function git_info { branch=$(git branch --show-current 2> /dev/null) if [ ! -z $branch ]; then - echo -n "@%F{cyan}$branch%f" + echo -n "@%F{cyan}$branch%f" status_output=$(git status --short) |