jethrokuan / z

Pure-fish z directory jumping
MIT License
1.29k stars 45 forks source link

Doesn't work with paths with hyphens in them #106

Closed tom-james-watson closed 2 years ago

tom-james-watson commented 2 years ago

I have some folders like my-folder. If I ever run any z command with a - in it, e.g. z my-folder, then it consistently fails to find any results and doesn't change directory.

Have confirmed on macOS 11.6.2 and Ubuntu 21.10.

Thanks for the awesome script by the way - much appreciated!

krobelus commented 2 years ago

works for me, can you check fish_trace=1 z my-folder

tom-james-watson commented 2 years ago

Using an actual real folder dev-database:

++++ _zlua dev-database
++++++ set -l arg_mode ''
++++++ set -l arg_type ''
++++++ set -l arg_subdir ''
++++++ set -l arg_inter ''
++++++ set -l arg_strip ''
++++++ function _zlua_call
++++++ if
++++++ test dev-database = --add
++++++ else if
++++++ test dev-database = --complete
++++++ end if
++++++ while
++++++ true
++++++++ break
++++++ end while
++++++ if
++++++ test '' = -h
++++++ else if
++++++ test '' = --purge
++++++ else if
++++++ test '' = -l
++++++ else if
+++++++ count dev-database
++++++ test 1 -eq 0
++++++ else if
++++++ test -n ''
++++++ else
++++++++ _zlua_call /usr/bin/lua /home/<USER>/.config/fish/z.lua --cd '' '' '' dev-database
+++++++++++ string escape -- /usr/bin/lua /home/<USER>/.config/fish/z.lua --cd '' '' '' dev-database
++++++++++ eval /usr/bin/lua /home/<USER>/.config/fish/z.lua --cd \'\' \'\' \'\' dev-database
+++++++++++ /usr/bin/lua /home/<USER>/.config/fish/z.lua --cd '' '' '' dev-database
+++++++ set -l dest
+++++++ if
+++++++ test -n '' -a -d ''
+++++++ end if
++++++ end if

If relevant, using fish 3.1.2.

krobelus commented 2 years ago

_zlua is coming from somewhere else, try to get rid of that.

If this works in HOME=(mktemp -d) fish (that is install inside the temporary HOME), then _zlua is lurking somewhere in your $HOME

tom-james-watson commented 2 years ago

Yeah sorry it looks like I had a different version of fish-based z. Not actually sure where it came from. I've pulled in your version from fresh and can confirm it works as expected. Thanks!