61b144d809f8f8258cfd74a4bb3c6c8b66bac0b1

Author
Benjamin Bock <bb@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(magic-enter plugin): Add support for jj to magic-enter plugin (#13241)

Diff

 1diff --git a/plugins/magic-enter/magic-enter.plugin.zsh b/plugins/magic-enter/magic-enter.plugin.zsh
 2index 55b893535ca3895ea91de3687acaf17dd1b650a8..c3175b70b1016079cb9e758922644ec5b2f64309 100644
 3--- a/plugins/magic-enter/magic-enter.plugin.zsh
 4+++ b/plugins/magic-enter/magic-enter.plugin.zsh
 5@@ -1,5 +1,6 @@
 6 # Default commands
 7 : ${MAGIC_ENTER_GIT_COMMAND:="git status -u ."} # run when in a git repository
 8+: ${MAGIC_ENTER_JJ_COMMAND:="jj st --no-pager ."} # run when in a jj repository
 9 : ${MAGIC_ENTER_OTHER_COMMAND:="ls -lh ."}      # run anywhere else
10 
11 magic-enter() {
12@@ -9,7 +10,9 @@ magic-enter() {
13     return
14   fi
15 
16-  if command git rev-parse --is-inside-work-tree &>/dev/null; then
17+  if command jj st &>/dev/null; then # needs to be before git to handle colocated repositories
18+    BUFFER="$MAGIC_ENTER_JJ_COMMAND"
19+  elif command git rev-parse --is-inside-work-tree &>/dev/null; then
20     BUFFER="$MAGIC_ENTER_GIT_COMMAND"
21   else
22     BUFFER="$MAGIC_ENTER_OTHER_COMMAND"