1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-17 13:19:48 +00:00

new $_ZL_FZF_HEIGHT, set to 0 to use fullscreen

This commit is contained in:
skywind3000
2019-02-21 12:12:58 +08:00
parent 68de23ecef
commit 5f7fa928b6
2 changed files with 8 additions and 5 deletions

View File

@@ -458,6 +458,7 @@ As you see, z.lua is the fastest one and requires less resource.
## History
- 1.5.8 (2019-02-21): new `$_ZL_FZF_HEIGHT` to control `--height` parameter in fzf.
- 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".

12
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.7, Last Modified: 2019/02/21 11:07
-- Version 1.5.8, Last Modified: 2019/02/21 12:08
--
-- * 10x faster than fasd and autojump, 3x faster than z.sh
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -1461,8 +1461,9 @@ function z_cd(patterns)
cmd = ((fzf == '') and 'fzf' or fzf) .. ' ' .. cmd .. ' ' .. flag
if not windows then
tmpname = os.tmpname()
if not os.environ('_ZL_FZF_FULLSCR', false) then
cmd = cmd .. ' --height 35%'
local height = os.environ('_ZL_FZF_HEIGHT', '35%')
if height ~= nil and height ~= '' and height ~= '0' then
cmd = cmd .. ' --height ' .. height
end
cmd = cmd .. ' < "' .. tmpname .. '"'
else
@@ -2005,8 +2006,9 @@ function z_shell_init(opts)
print(script_complete_bash)
if opts.fzf ~= nil then
fzf_cmd = "fzf --nth 2.. --reverse --inline-info --tac "
if not os.environ('_ZL_FZF_FULLSCR', false) then
fzf_cmd = fzf_cmd .. ' --height 35%'
local height = os.environ('_ZL_FZF_HEIGHT', '35%')
if height ~= nil and height ~= '' and height ~= '0' then
fzf_cmd = fzf_cmd .. ' --height ' .. height .. ' '
end
local flag = os.environ('_ZL_FZF_FLAG', '')
flag = (flag == '' or flag == nil) and '+s -e' or flag