mirror of
https://github.com/skywind3000/z.lua
synced 2026-03-18 21:59:49 +00:00
improve last segment detection
This commit is contained in:
@@ -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:
|
||||
|
||||
|
||||
6
z.lua
6
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)
|
||||
|
||||
Reference in New Issue
Block a user