1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-18 21:59:49 +00:00

new "$_ZL_FZF_SORT" to sort directories by alphabet in fzf

This commit is contained in:
skywind3000
2019-02-20 20:24:24 +08:00
parent b1702839d2
commit db92fa0a1c
2 changed files with 5 additions and 1 deletions

View File

@@ -458,6 +458,7 @@ As you see, z.lua is the fastest one and requires less resource.
## History
- 1.5.6 (2019-02-20): new `$_ZL_FZF_SORT` to sort directories by alphabet in fzf
- 1.5.5 (2019-02-20): `$_ZL_FZF_FLAG` can be used to override fzf flags, default to "+s -e".
- 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)).
- 1.5.3 (2019-02-17): new `$_ZL_FZF_FLAG` for passing additional flags to fzf, add `-e` argument to fzf.

5
z.lua
View File

@@ -4,7 +4,7 @@
-- z.lua - a cd command that learns, by skywind 2018, 2019
-- Licensed under MIT license.
--
-- Version 1.5.5, Last Modified: 2019/02/20 12:07
-- Version 1.5.6, Last Modified: 2019/02/20 20:20
--
-- * 10x faster than fasd and autojump, 3x faster than z.sh
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -1463,6 +1463,9 @@ function z_cd(patterns)
tmpname = os.environ('TMP', '') .. '\\zlua_' .. tmpname .. '.txt'
cmd = 'type "' .. tmpname .. '" | ' .. cmd
end
if os.environ('_ZL_FZF_SORT', false) then
table.sort(M, function (a, b) return a.name > b.name end)
end
PRINT_MODE = tmpname
z_print(M, true, false)
retval = os.call(cmd)