Skip to content

Commit db92fa0

Browse files
author
skywind3000
committed
new "$_ZL_FZF_SORT" to sort directories by alphabet in fzf
1 parent b170283 commit db92fa0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ As you see, z.lua is the fastest one and requires less resource.
458458

459459
## History
460460

461+
- 1.5.6 (2019-02-20): new `$_ZL_FZF_SORT` to sort directories by alphabet in fzf
461462
- 1.5.5 (2019-02-20): `$_ZL_FZF_FLAG` can be used to override fzf flags, default to "+s -e".
462463
- 1.5.4 (2019-02-19): fixed: file/path existence detection fails on read-only fs (closed [#49](https://github.com/skywind3000/z.lua/issues/49) by [@contrun](https://github.com/contrun)).
463464
- 1.5.3 (2019-02-17): new `$_ZL_FZF_FLAG` for passing additional flags to fzf, add `-e` argument to fzf.

z.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- z.lua - a cd command that learns, by skywind 2018, 2019
55
-- Licensed under MIT license.
66
--
7-
-- Version 1.5.5, Last Modified: 2019/02/20 12:07
7+
-- Version 1.5.6, Last Modified: 2019/02/20 20:20
88
--
99
-- * 10x faster than fasd and autojump, 3x faster than z.sh
1010
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -1463,6 +1463,9 @@ function z_cd(patterns)
14631463
tmpname = os.environ('TMP', '') .. '\\zlua_' .. tmpname .. '.txt'
14641464
cmd = 'type "' .. tmpname .. '" | ' .. cmd
14651465
end
1466+
if os.environ('_ZL_FZF_SORT', false) then
1467+
table.sort(M, function (a, b) return a.name > b.name end)
1468+
end
14661469
PRINT_MODE = tmpname
14671470
z_print(M, true, false)
14681471
retval = os.call(cmd)

0 commit comments

Comments
 (0)