fix: interactive completion for fish

This commit is contained in:
NextAlone 2022-04-27 09:41:36 +08:00
parent 6b2c6a2bc3
commit 57ff30d7af
No known key found for this signature in database
GPG Key ID: DBA7B0AEF8C1CD2C
1 changed files with 7 additions and 2 deletions

View File

@ -72,7 +72,12 @@ function __zoxide_z
else if test $argc -eq 1 -a -d $argv[1] else if test $argc -eq 1 -a -d $argv[1]
__zoxide_cd $argv[1] __zoxide_cd $argv[1]
else else
set -l result (command zoxide query --exclude (__zoxide_pwd) -- $argv) if string match '*#*' $argv &>/dev/null
set target (string match '*#*' $argv | string replace \# '')
else
set target $argv
end
set -l result (command zoxide query --exclude (__zoxide_pwd) -- $target)
and __zoxide_cd $result and __zoxide_cd $result
end end
end end
@ -89,7 +94,7 @@ function __zoxide_z_complete
# If the last argument is empty, use interactive selection. # If the last argument is empty, use interactive selection.
set -l query $tokens[2..-1] set -l query $tokens[2..-1]
set -l result (zoxide query -i -- $query) set -l result (zoxide query -i -- $query)
and commandline --current-process "$tokens[1] "(string escape $result) and echo \#(string escape $result)
commandline --function repaint commandline --function repaint
end end
end end