1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2025-11-05 14:01:16 +08:00

fix(magic-enter): check for cmd existance before executing

Closes #13294
This commit is contained in:
Carlo Sala 2025-09-10 09:30:04 +08:00
parent 8c168e2662
commit 9e23925b85
No known key found for this signature in database
GPG Key ID: DA6FB450C1A4FE9A

View File

@ -10,9 +10,10 @@ magic-enter() {
return return
fi fi
if command jj st >/dev/null 2>&1; then # needs to be before git to handle colocated repositories # 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" BUFFER="$MAGIC_ENTER_JJ_COMMAND"
elif command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then elif (( $+commands[git] )) && command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
BUFFER="$MAGIC_ENTER_GIT_COMMAND" BUFFER="$MAGIC_ENTER_GIT_COMMAND"
else else
BUFFER="$MAGIC_ENTER_OTHER_COMMAND" BUFFER="$MAGIC_ENTER_OTHER_COMMAND"