Closed ilyagr closed 9 months ago
I believe this is a better solution than current z.lua’s method, will look into it ASAP
Another option would be to merge the two sets of results if _ZL_HYPHEN
is not defined. Usually, it would be equivalent; the only question is which is less surprising. I'm happy with either.
thanks
Previously, you needed to set
_ZL_HYPHEN=1
to treat-
as a normal character. Otherwise, it was treated as a Lua regexp special character, see https://www.lua.org/pil/20.2.html. Note that it is not super-useful to treat-
as a special character; it is almost the same as*
and the difference is not very useful in the context of fuzzy matching.Now, if
_ZL_HYPHEN
is not set, z.lua first tries to treat it as a regexp character. If there are no results (which is likely if the user does not know it's a special character), z.lua tries again, treating-
as a normal character this time.If
_ZL_HYPHEN=0
or_ZL_HYPHEN=1
, z.lua will always treat-
as either a regex symbol or as a normal character (respectively).Hopefully, this will make the FAQ at https://github.com/skywind3000/z.lua/wiki/FAQ#how-to-input-a-hyphen---in-the-keyword- unnecessary. It took me weeks to look into the question of why
z home-manager
refused to work and to find that FAQ.I only tested this briefly, but it seems to work.