|
4 | 4 | -- z.lua - a cd command that learns, by skywind 2018, 2019
|
5 | 5 | -- Licensed under MIT license.
|
6 | 6 | --
|
7 |
| --- Version 1.5.4, Last Modified: 2019/02/19 11:18 |
| 7 | +-- Version 1.5.5, Last Modified: 2019/02/20 12:07 |
8 | 8 | --
|
9 | 9 | -- * 10x faster than fasd and autojump, 3x faster than z.sh
|
10 | 10 | -- * available for posix shells: bash, zsh, sh, ash, dash, busybox
|
@@ -1448,9 +1448,10 @@ function z_cd(patterns)
|
1448 | 1448 | elseif Z_INTERACTIVE == 2 then
|
1449 | 1449 | local fzf = os.environ('_ZL_FZF', 'fzf')
|
1450 | 1450 | local tmpname = '/tmp/zlua.txt'
|
1451 |
| - local cmd = '--nth 2.. --reverse --inline-info +s --tac -e' |
1452 |
| - cmd = ((fzf == '') and 'fzf' or fzf) .. ' ' .. cmd |
1453 |
| - cmd = cmd .. ' ' .. os.environ('_ZL_FZF_FLAG', '') .. ' ' |
| 1451 | + local cmd = '--nth 2.. --reverse --inline-info --tac ' |
| 1452 | + local flag = os.environ('_ZL_FZF_FLAG', '') |
| 1453 | + flag = (flag == '' or flag == nil) and '+s -e' or flag |
| 1454 | + cmd = ((fzf == '') and 'fzf' or fzf) .. ' ' .. cmd .. ' ' .. flag |
1454 | 1455 | if not windows then
|
1455 | 1456 | tmpname = os.tmpname()
|
1456 | 1457 | if not os.environ('_ZL_FZF_FULLSCR', false) then
|
@@ -1996,11 +1997,13 @@ function z_shell_init(opts)
|
1996 | 1997 | end
|
1997 | 1998 | print(script_complete_bash)
|
1998 | 1999 | if opts.fzf ~= nil then
|
1999 |
| - fzf_cmd = "fzf --nth 2 --reverse --inline-info +s --tac -e" |
| 2000 | + fzf_cmd = "fzf --nth 2 --reverse --inline-info --tac " |
2000 | 2001 | if not os.environ('_ZL_FZF_FULLSCR', false) then
|
2001 | 2002 | fzf_cmd = fzf_cmd .. ' --height 35%'
|
2002 | 2003 | end
|
2003 |
| - fzf_cmd = fzf_cmd .. ' ' .. os.environ('_ZL_FZF_FLAG', '') .. ' ' |
| 2004 | + local flag = os.environ('_ZL_FZF_FLAG', '') |
| 2005 | + flag = (flag == '' or flag == nil) and '+s -e' or flag |
| 2006 | + fzf_cmd = fzf_cmd .. ' ' .. flag .. ' ' |
2004 | 2007 | print('zlua_fzf="' .. fzf_cmd .. '"')
|
2005 | 2008 | print(script_fzf_complete_bash)
|
2006 | 2009 | end
|
|
0 commit comments