m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 00:03:39 -05:00

Update examples and bash completion

- Use tput sc/rc instead of redraw-current-line
- Escape selected items with printf
This commit is contained in:
Junegunn Choi
2013-11-27 01:00:23 +09:00
parent 344b57fe33
commit 07aee79bd8
2 changed files with 17 additions and 20 deletions

View File

@@ -46,12 +46,9 @@ _fzf_generic_completion() {
leftover=${base/#"$dir"}
leftover=${leftover/#\/}
[ "$dir" = './' ] && dir=''
tput sc
matches=$(find "$dir"* $1 2> /dev/null | fzf $FZF_COMPLETION_OPTS $2 -q "$leftover" | while read item; do
if [[ ${item} =~ \ ]]; then
echo -n "\"$item\" "
else
echo -n "$item "
fi
printf '%q ' "$item"
done)
matches=${matches% }
if [ -n "$matches" ]; then
@@ -59,6 +56,7 @@ _fzf_generic_completion() {
else
COMPREPLY=( "$cur" )
fi
tput rc
return 0
fi
dir=$(dirname "$dir")
@@ -110,7 +108,3 @@ for cmd in "
complete -F _fzf_all_completion -o default -o bashdefault $cmd
done
bind '"\e\e": complete'
bind '"\er": redraw-current-line'
bind '"\C-i": "\e\e\er"'