Make z.lua try treating -
as a normal character if there are no results
#196
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, you needed to set
_ZL_HYPHEN=1
to treat-
as a normalcharacter. 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 differenceis 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 regexpcharacter. 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 normalcharacter this time.
If
_ZL_HYPHEN=0
or_ZL_HYPHEN=1
, z.lua will always treat-
aseither 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.