diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2024-03-13 20:56:31 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 20:56:31 +0900 |
commit | d282a1649d7d953f028306f13d6616958f3fd1f3 (patch) | |
tree | ddab9c74f9afbf1d66f391064bb3fb8ee870cf53 /shell/key-bindings.bash | |
parent | 6ce8d49d1b6a38a1a7cbb02e2726956b211f46be (diff) |
Add walker options and replace 'find' with the built-in walker (#3649)
Diffstat (limited to 'shell/key-bindings.bash')
-rw-r--r-- | shell/key-bindings.bash | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index c4dce3ba..f6cd48f1 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -17,14 +17,9 @@ # Key bindings # ------------ __fzf_select__() { - local cmd opts - cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ - -o -type f -print \ - -o -type d -print \ - -o -type l -print 2> /dev/null | command cut -b3-"}" - opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse --scheme=path ${FZF_DEFAULT_OPTS-} ${FZF_CTRL_T_OPTS-} -m" - eval "$cmd" | - FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) "$@" | + local opts + opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse --walker=file,dir,follow,hidden --scheme=path ${FZF_DEFAULT_OPTS-} ${FZF_CTRL_T_OPTS-} -m" + FZF_DEFAULT_COMMAND=${FZF_CTRL_T_COMMAND:-} FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) "$@" | while read -r item; do printf '%q ' "$item" # escape special chars done @@ -42,11 +37,11 @@ fzf-file-widget() { } __fzf_cd__() { - local cmd opts dir - cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ - -o -type d -print 2> /dev/null | command cut -b3-"}" - opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse --scheme=path ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-} +m" - dir=$(set +o pipefail; eval "$cmd" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd)) && printf 'builtin cd -- %q' "$dir" + local opts dir + opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse --walker=dir,follow,hidden --scheme=path ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-} +m" + dir=$( + FZF_DEFAULT_COMMAND=${FZF_ALT_C_COMMAND:-} FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) + ) && printf 'builtin cd -- %q' "$dir" } if command -v perl > /dev/null; then |