Make z more plugin compatible with cd

This commit is contained in:
Klaus Alexander Seistrup 2020-03-10 13:25:14 +01:00
parent 6d91b4e3c4
commit d44e66e907
1 changed files with 15 additions and 10 deletions

View File

@ -1,13 +1,18 @@
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
if test (count $argv) -gt 0
if test "$argv[1]" = "-"
cd -
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 ~
end
end