From 5f7fa928b64d04e929139ef1808f2dd0f73011c8 Mon Sep 17 00:00:00 2001 From: skywind3000 Date: Thu, 21 Feb 2019 12:12:58 +0800 Subject: [PATCH] new $_ZL_FZF_HEIGHT, set to 0 to use fullscreen --- README.md | 1 + z.lua | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 533f1f4..82f22dc 100644 --- a/README.md +++ b/README.md @@ -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". diff --git a/z.lua b/z.lua index 97b0599..383c75c 100755 --- a/z.lua +++ b/z.lua @@ -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