diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2013-11-27 01:00:23 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2013-11-27 01:14:36 +0900 |
commit | 07aee79bd8804bbee88bfc9db7f694940a227ea3 (patch) | |
tree | fbdf28f2de07d978010ccd5011b06b5a4462e403 /fzf-completion.bash | |
parent | 344b57fe33c661ababcc00da6a3a972dd1415298 (diff) |
Update examples and bash completion
- Use tput sc/rc instead of redraw-current-line
- Escape selected items with printf
Diffstat (limited to 'fzf-completion.bash')
-rw-r--r-- | fzf-completion.bash | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fzf-completion.bash b/fzf-completion.bash index c4aca319..6697b372 100644 --- a/fzf-completion.bash +++ b/fzf-completion.bash @@ -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"' - |