summaryrefslogtreecommitdiff
path: root/plugins/magic-enter/magic-enter.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/magic-enter/magic-enter.plugin.zsh')
-rw-r--r--plugins/magic-enter/magic-enter.plugin.zsh6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/magic-enter/magic-enter.plugin.zsh b/plugins/magic-enter/magic-enter.plugin.zsh
index 55b893535..722d747f3 100644
--- a/plugins/magic-enter/magic-enter.plugin.zsh
+++ b/plugins/magic-enter/magic-enter.plugin.zsh
@@ -1,5 +1,6 @@
# Default commands
: ${MAGIC_ENTER_GIT_COMMAND:="git status -u ."} # run when in a git repository
+: ${MAGIC_ENTER_JJ_COMMAND:="jj st --no-pager ."} # run when in a jj repository
: ${MAGIC_ENTER_OTHER_COMMAND:="ls -lh ."} # run anywhere else
magic-enter() {
@@ -9,7 +10,10 @@ magic-enter() {
return
fi
- if command git rev-parse --is-inside-work-tree &>/dev/null; then
+ # needs to be before git to handle colocated repositories
+ if (( $+commands[jj] )) && command jj st >/dev/null 2>&1; then
+ BUFFER="$MAGIC_ENTER_JJ_COMMAND"
+ elif (( $+commands[git] )) && command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
BUFFER="$MAGIC_ENTER_GIT_COMMAND"
else
BUFFER="$MAGIC_ENTER_OTHER_COMMAND"