summaryrefslogtreecommitdiffstats
path: root/shell/completion.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'shell/completion.zsh')
-rw-r--r--shell/completion.zsh46
1 files changed, 26 insertions, 20 deletions
diff --git a/shell/completion.zsh b/shell/completion.zsh
index c4ba2c75..163b0299 100644
--- a/shell/completion.zsh
+++ b/shell/completion.zsh
@@ -77,22 +77,19 @@ fi
{
# To use custom commands instead of find, override _fzf_compgen_{path,dir}
-if ! declare -f _fzf_compgen_path > /dev/null; then
- _fzf_compgen_path() {
- echo "$1"
- command find -L "$1" \
- -name .git -prune -o -name .hg -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \
- -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
- }
-fi
-
-if ! declare -f _fzf_compgen_dir > /dev/null; then
- _fzf_compgen_dir() {
- command find -L "$1" \
- -name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \
- -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
- }
-fi
+#
+# _fzf_compgen_path() {
+# echo "$1"
+# command find -L "$1" \
+# -name .git -prune -o -name .hg -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \
+# -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
+# }
+#
+# _fzf_compgen_dir() {
+# command find -L "$1" \
+# -name .git -prune -o -name .hg -prune -o -name .svn -prune -o -type d \
+# -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@'
+# }
###########################################################
@@ -148,10 +145,19 @@ __fzf_generic_path_completion() {
leftover=${leftover/#\/}
[ -z "$dir" ] && dir='.'
[ "$dir" != "/" ] && dir="${dir/%\//}"
- matches=$(eval "$compgen $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --scheme=path --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-}" __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" | while read item; do
- item="${item%$suffix}$suffix"
- echo -n "${(q)item} "
- done)
+ matches=$(
+ unset FZF_DEFAULT_COMMAND
+ export FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --scheme=path --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-}"
+ if declare -f "$compgen" > /dev/null; then
+ eval "$compgen $(printf %q "$dir")" | __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover"
+ else
+ [[ $compgen =~ dir ]] && walker=dir,follow || walker=file,dir,follow,hidden
+ __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" --walker "$walker" --walker-root="$dir" < /dev/tty
+ fi | while read item; do
+ item="${item%$suffix}$suffix"
+ echo -n "${(q)item} "
+ done
+ )
matches=${matches% }
if [ -n "$matches" ]; then
LBUFFER="$lbuf$matches$tail"