1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-06-30 09:58:50 +00:00

Merge pull request #39 from BarbUk/fix/bash_fzf_enhancement

Some enhancement to bash fzf completion
This commit is contained in:
Linwei
2019-02-10 16:26:20 +08:00
committed by GitHub
+6 -7
View File
@@ -1878,17 +1878,16 @@ if [ "$TERM" != "dumb" ] && command -v fzf >/dev/null 2>&1; then
_zlua_fzf_complete() {
local query="${COMP_WORDS[COMP_CWORD]}"
local selected=$(_zlua --complete | $zlua_fzf --query "$query")
printf '\e[5n'
local selected=$(_zlua | sed "s|$HOME|\~|" | $zlua_fzf --query "$query")
if [ -n "$selected" ]; then
COMPREPLY=("$selected")
return 0
COMPREPLY=( "$selected" )
fi
printf '\e[5n'
}
complete -o bashdefault -F _zlua_fzf_complete ${_ZL_CMD:-z}
complete -o bashdefault -o nospace -F _zlua_fzf_complete ${_ZL_CMD:-z}
fi
]]
@@ -1933,7 +1932,7 @@ function z_shell_init(opts)
end
print(script_complete_bash)
if opts.fzf ~= nil then
fzf_cmd = "fzf --reverse --inline-info +s"
fzf_cmd = "fzf --nth 2 --reverse --inline-info +s --tac"
if not os.getenv('_ZL_FZF_FULLSCR') then
fzf_cmd = fzf_cmd .. ' --height 35%'
end