|
|
|
@ -1,5 +1,6 @@ |
|
|
|
# Default commands |
|
|
|
# Default commands |
|
|
|
: ${MAGIC_ENTER_GIT_COMMAND:="git status -u ."} # run when in a git repository |
|
|
|
: ${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_OTHER_COMMAND:="ls -lh ."} # run anywhere else |
|
|
|
|
|
|
|
|
|
|
|
magic-enter() { |
|
|
|
magic-enter() { |
|
|
|
@ -9,7 +10,9 @@ magic-enter() { |
|
|
|
return |
|
|
|
return |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if command git rev-parse --is-inside-work-tree &>/dev/null; then |
|
|
|
if command jj st &>/dev/null; then # needs to be before git to handle colocated repositories |
|
|
|
|
|
|
|
BUFFER="$MAGIC_ENTER_JJ_COMMAND" |
|
|
|
|
|
|
|
elif command git rev-parse --is-inside-work-tree &>/dev/null; then |
|
|
|
BUFFER="$MAGIC_ENTER_GIT_COMMAND" |
|
|
|
BUFFER="$MAGIC_ENTER_GIT_COMMAND" |
|
|
|
else |
|
|
|
else |
|
|
|
BUFFER="$MAGIC_ENTER_OTHER_COMMAND" |
|
|
|
BUFFER="$MAGIC_ENTER_OTHER_COMMAND" |
|
|
|
|