Merge pull request #458 from frizinak/fix-autocomplete-abs

Fix auto-completion for `/`
This commit is contained in:
Junegunn Choi 2015-12-29 08:22:52 +09:00
commit a9aa263d3a
2 changed files with 4 additions and 2 deletions

View File

@ -110,7 +110,8 @@ __fzf_generic_path_completion() {
if [ -z "$dir" -o -d "$dir" ]; then if [ -z "$dir" -o -d "$dir" ]; then
leftover=${base/#"$dir"} leftover=${base/#"$dir"}
leftover=${leftover/#\/} leftover=${leftover/#\/}
[ -z "$dir" ] && dir='.' || dir="${dir/%\//}" [ -z "$dir" ] && dir='.'
[ "$dir" != "/" ] && dir="${dir/%\//}"
tput sc tput sc
matches=$(\find -L "$dir" $1 -a -not -path "$dir" -print 2> /dev/null | sed 's@^\./@@' | $fzf $FZF_COMPLETION_OPTS $2 -q "$leftover" | while read item; do matches=$(\find -L "$dir" $1 -a -not -path "$dir" -print 2> /dev/null | sed 's@^\./@@' | $fzf $FZF_COMPLETION_OPTS $2 -q "$leftover" | while read item; do
printf "%q$3 " "$item" printf "%q$3 " "$item"

View File

@ -30,7 +30,8 @@ __fzf_generic_path_completion() {
if [ -z "$dir" -o -d ${~dir} ]; then if [ -z "$dir" -o -d ${~dir} ]; then
leftover=${base/#"$dir"} leftover=${base/#"$dir"}
leftover=${leftover/#\/} leftover=${leftover/#\/}
[ -z "$dir" ] && dir='.' || dir="${dir/%\//}" [ -z "$dir" ] && dir='.'
[ "$dir" != "/" ] && dir="${dir/%\//}"
dir=${~dir} dir=${~dir}
matches=$(\find -L "$dir" ${=find_opts} -a -not -path "$dir" -print 2> /dev/null | sed 's@^\./@@' | ${=fzf} ${=FZF_COMPLETION_OPTS} ${=fzf_opts} -q "$leftover" | while read item; do matches=$(\find -L "$dir" ${=find_opts} -a -not -path "$dir" -print 2> /dev/null | sed 's@^\./@@' | ${=fzf} ${=FZF_COMPLETION_OPTS} ${=fzf_opts} -q "$leftover" | while read item; do
printf "%q$suffix " "$item" printf "%q$suffix " "$item"