diff --git a/functions/z.fish b/functions/z.fish index 1e05067..faab2b9 100644 --- a/functions/z.fish +++ b/functions/z.fish @@ -1,13 +1,22 @@ function z - if test (count $argv) -gt 0 - set _Z_RESULT (zoxide query $argv) - switch "$_Z_RESULT" - case 'query: *' - cd (string sub -s 8 -- "$_Z_RESULT") - commandline -f repaint - case '*' - echo -n "$_Z_RESULT" - end + set -l argc (count $argv) + if test $argc -gt 0 + if test $argc -eq 1 -a "$argv[1]" = "-" + cd - + commandline -f repaint + else + set _Z_RESULT (zoxide query $argv) + switch "$_Z_RESULT" + case 'query: *' + cd (string sub -s 8 -- "$_Z_RESULT") + commandline -f repaint + case '*' + echo -n "$_Z_RESULT" + end end + else + cd ~ + commandline -f repaint + end end