mirror of
https://github.com/skywind3000/z.lua
synced 2026-03-15 04:09:49 +00:00
v1.5.7: rename $_ZL_FZF_SORT to $_ZL_INT_SORT it will affect both -i and -I.
This commit is contained in:
@@ -458,6 +458,7 @@ As you see, z.lua is the fastest one and requires less resource.
|
||||
|
||||
## History
|
||||
|
||||
- 1.5.7 (2019-02-21): rename `$_ZL_FZF_SORT` to `$_ZL_INT_SORT` it will affect both `-i` and `-I`.
|
||||
- 1.5.6 (2019-02-20): set `$_ZL_FZF_SORT` to 1 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)).
|
||||
|
||||
12
z.lua
12
z.lua
@@ -4,7 +4,7 @@
|
||||
-- z.lua - a cd command that learns, by skywind 2018, 2019
|
||||
-- Licensed under MIT license.
|
||||
--
|
||||
-- Version 1.5.6, Last Modified: 2019/02/20 23:30
|
||||
-- Version 1.5.7, Last Modified: 2019/02/21 11:07
|
||||
--
|
||||
-- * 10x faster than fasd and autojump, 3x faster than z.sh
|
||||
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
|
||||
@@ -770,6 +770,10 @@ end
|
||||
-----------------------------------------------------------------------
|
||||
function os.environ(name, default)
|
||||
local value = os.getenv(name)
|
||||
if os.envmap ~= nil and type(os.envmap) == 'table' then
|
||||
local t = os.envmap[name]
|
||||
value = (t ~= nil and type(t) == 'string') and t or value
|
||||
end
|
||||
if value == nil then
|
||||
return default
|
||||
elseif type(default) == 'boolean' then
|
||||
@@ -1427,6 +1431,9 @@ function z_cd(patterns)
|
||||
elseif Z_INTERACTIVE == 0 then
|
||||
return M[1].name
|
||||
end
|
||||
if os.environ('_ZL_INT_SORT', false) then
|
||||
table.sort(M, function (a, b) return a.name < b.name end)
|
||||
end
|
||||
local retval = nil
|
||||
if Z_INTERACTIVE == 1 then
|
||||
PRINT_MODE = '<stderr>'
|
||||
@@ -1463,9 +1470,6 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user