diff --git a/.config/zsh-abbr/abbr-jj b/.config/zsh-abbr/abbr-jj deleted file mode 100644 index 29e638f..0000000 --- a/.config/zsh-abbr/abbr-jj +++ /dev/null @@ -1,6 +0,0 @@ -abbr add -S --force "c"="jj commit" -abbr add -S --force "new"="jj new main" -abbr add -S --force "p"="jj git push" -abbr add -S --force "s"="jj status" -abbr add -S --force "sl"="jj log --ignore-working-copy" -abbr add -S --force "d"="jj show" diff --git a/.config/zsh-abbr/user-abbreviations b/.config/zsh-abbr/user-abbreviations index 3b32d17..15704f2 100644 --- a/.config/zsh-abbr/user-abbreviations +++ b/.config/zsh-abbr/user-abbreviations @@ -1,4 +1,4 @@ -abbr "abbr-jj"="source ~/.config/zsh-abbr/abbr-jj" +abbr "b"="git branch -va" abbr "c"="git commit" abbr "d"="git diff --stat -p -C --color-words" abbr "g"="git" @@ -6,4 +6,6 @@ abbr "k"="kubectl" abbr "new"="git checkout --detach main" abbr "p"="git push" abbr "s"="git status" -abbr "sl"="git sl" +abbr "sl"="git branchless smartlog" +abbr "sw"="git branchless switch --interactive" +abbr "sy"="git sync --pull" diff --git a/.zshrc b/.zshrc index cc414c6..00e4b08 100644 --- a/.zshrc +++ b/.zshrc @@ -145,6 +145,37 @@ rg() { /usr/bin/rg -p "$@" | bat } + +## Jujutsu +jj_chpwd() { + _state="$JJ_REPO" + JJ_REPO=$(jj workspace root --ignore-working-copy 2>/dev/null) + if [[ "$JJ_REPO" == "$_state" ]]; then + return + fi + if [[ -n "$JJ_REPO" ]]; then + abbr add -S --force "b"="jj branch list" + abbr add -S --force "c"="jj commit" + abbr add -S --force "d"="jj show" + abbr add -S --force "new"="jj new main" + abbr add -S --force "p"="jj git push" + abbr add -S --force "s"="jj status" + abbr add -S --force "sl"="jj log --ignore-working-copy" + abbr add -S --force "sy"="jj git fetch" + else + abbr erase -S b + abbr erase -S c + abbr erase -S d + abbr erase -S new + abbr erase -S p + abbr erase -S s + abbr erase -S sl + abbr erase -S sy + fi +} +chpwd_functions+=jj_chpwd + + ## Prompt prompt_chpwd() {