From 57ff30d7aff902519bb6a5a45317d8f6405cc37d Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Wed, 27 Apr 2022 09:41:36 +0800 Subject: [PATCH] fix: interactive completion for fish --- templates/fish.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/templates/fish.txt b/templates/fish.txt index 6d3ed4f..5ecacf8 100644 --- a/templates/fish.txt +++ b/templates/fish.txt @@ -72,7 +72,12 @@ function __zoxide_z else if test $argc -eq 1 -a -d $argv[1] __zoxide_cd $argv[1] 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 end end @@ -89,7 +94,7 @@ function __zoxide_z_complete # If the last argument is empty, use interactive selection. set -l query $tokens[2..-1] set -l result (zoxide query -i -- $query) - and commandline --current-process "$tokens[1] "(string escape $result) + and echo \#(string escape $result) commandline --function repaint end end