You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我设想的做法是当 z one two three four 失败后,使用去掉了最后一个 pattern 的 one two three 来匹配,当在数据中匹配到了 one two three ,就在这个路径中找有没有子目录 four ,如果就直接 cd 进入。
效果类似于:
$ grep 'linux/drivers'~/.zlua # 记录中无 linux/driver
$ grep 'linux'~/.zlua # 记录中有 linux/home/xxx/linux|2|1676041029
$ z linux drivers
$ pwd/home/xxx/linux/drivers
我认为可以添加如下几行实现这个功能:
--- a/z.lua+++ b/z.lua@@ -1954,6 +1954,12 @@ function main(argv)
path = os.path.norm(path)
end
end
+ if path == nil then+ local prefix = table.pack(table.unpack(args, 1, #args - 1))+ local last = args[#args]+ path = z_cd(prefix)..os.path.sep..last+ path = os.path.isdir(path) and path or nil+ end
end
if path ~= nil then
io.write(path .. (options['-e'] and "\n" or ""))
The text was updated successfully, but these errors were encountered:
我设想的做法是当
z one two three four
失败后,使用去掉了最后一个 pattern 的one two three
来匹配,当在数据中匹配到了one two three
,就在这个路径中找有没有子目录four
,如果就直接cd
进入。效果类似于:
我认为可以添加如下几行实现这个功能:
The text was updated successfully, but these errors were encountered: