diff --git a/templates/fish.txt b/templates/fish.txt index fab533a..6ad10c5 100644 --- a/templates/fish.txt +++ b/templates/fish.txt @@ -101,8 +101,13 @@ function __zoxide_z_complete # If the last argument is empty, use interactive selection. set -l query $tokens[2..-1] set -l result (command zoxide query --exclude (__zoxide_pwd) --interactive -- $query 2>/dev/null) - and builtin commandline --replace -- "{{ cmd.unwrap_or("cd") }} "(string escape -- $result) - and builtin commandline --function repaint execute + if test $status -eq 0 + builtin commandline --function repaint + return + else + builtin commandline --replace -- "{{ cmd.unwrap_or("cd") }} "(string escape -- $result) + builtin commandline --function repaint execute + end end end complete --command __zoxide_z --no-files --arguments '(__zoxide_z_complete)'