|
4 | 4 | -- z.lua - a cd command that learns, by skywind 2018, 2019 |
5 | 5 | -- Licensed under MIT license. |
6 | 6 | -- |
7 | | --- Version 1.5.3, Last Modified: 2019/02/17 16:22 |
| 7 | +-- Version 1.5.4, Last Modified: 2019/02/19 11:18 |
8 | 8 | -- |
9 | 9 | -- * 10x faster than fasd and autojump, 3x faster than z.sh |
10 | 10 | -- * available for posix shells: bash, zsh, sh, ash, dash, busybox |
@@ -432,7 +432,7 @@ function os.path.isdir(pathname) |
432 | 432 | end |
433 | 433 | end |
434 | 434 | local name = pathname |
435 | | - if not name:endswith('/') then |
| 435 | + if (not name:endswith('/')) and (not name:endswith('\\')) then |
436 | 436 | name = name .. '/' |
437 | 437 | end |
438 | 438 | return os.path.exists(name) |
@@ -1275,13 +1275,14 @@ function z_match(patterns, method, subdir) |
1275 | 1275 | subdir = subdir ~= nil and subdir or false |
1276 | 1276 | local M = data_load(DATA_FILE) |
1277 | 1277 | M = data_select(M, patterns, false) |
| 1278 | + M = data_filter(M) |
1278 | 1279 | if Z_MATCHNAME then |
1279 | 1280 | local N = data_select(M, patterns, true) |
| 1281 | + N = data_filter(N) |
1280 | 1282 | if #N > 0 then |
1281 | 1283 | M = N |
1282 | 1284 | end |
1283 | 1285 | end |
1284 | | - M = data_filter(M) |
1285 | 1286 | M = data_update_frecent(M) |
1286 | 1287 | if method == 'time' then |
1287 | 1288 | current = os.time() |
@@ -1334,7 +1335,7 @@ end |
1334 | 1335 | ----------------------------------------------------------------------- |
1335 | 1336 | function z_print(M, weight, number) |
1336 | 1337 | local N = {} |
1337 | | - local maxsize = 10 |
| 1338 | + local maxsize = 9 |
1338 | 1339 | local numsize = string.len(tostring(#M)) |
1339 | 1340 | for _, item in pairs(M) do |
1340 | 1341 | local record = {} |
|
0 commit comments