diff --git a/README.md b/README.md index 028698c..b8b3608 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ If no match is found, it will fall back to default matching method. Since the last segment of a path is always easier to be recalled, it is sane to give it higher priority. You can also achieve this by typing `"z space$"` in both methods, but `"z wo"` is easier to type. - Tips: If you want your last query not to match the last segment of the path, append '$' as the last query. eg. `"z wo $"`. + Tips: If you want your last query not only to match the last segment of the path, append '$' as the last query. eg. `"z wo $"`. - cd to the existent path if there is no match: diff --git a/z.lua b/z.lua index 8b020b4..e1b23b7 100755 --- a/z.lua +++ b/z.lua @@ -4,7 +4,7 @@ -- z.lua - z.sh implementation in lua, by skywind 2018, 2019 -- Licensed under MIT license. -- --- Version 37, Last Modified: 2019/01/17 22:37 +-- Version 38, Last Modified: 2019/01/18 05:07 -- -- * 10x times faster than fasd and autojump -- * 3x times faster than rupa/z @@ -764,9 +764,9 @@ function path_match(pathname, patterns, matchlast) local index = #patterns local pat = patterns[index] if not windows then - last = string.match(pathname, ".*/(.*)") + last = string.match(pathname, ".*(/.*)") else - last = string.match(pathname, ".*[/\\](.*)") + last = string.match(pathname, ".*([/\\].*)") end if last then start, endup = last:find(pat, 1)