[shell] Fix pruning condition of find command for CTRL-T and ALT-C
Before adoption: this commit came in with the history the project adopted, so no landing records it.
`-fstype dev` is invalid. It's devfs on macOS and devtmpfs on Linux.
authored by Junegunn Choi · committed by Junegunn Choi · parent 2e8814b · Browse files · 3 files·+6 added−6 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+6 added−6 removed
- other:+6 added−6 removed
Provenance
- Commit
c49e65d- Tree
b52841c- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
2e8814b
3 files changed+6 added−6 removed
modified:shell/key-bindings.bash+2 added-2 removed
12344567831 unmodified lines4041424344444546474877 unmodified lines# Key bindings# ------------__fzf_select__() { local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . \\( -path '*/\\.*' -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 | sed 1d | cut -b3-"}" eval "$cmd | fzf -m $FZF_CTRL_T_OPTS" | while read -r item; do31 unmodified lines}
__fzf_cd__() { local cmd dir cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ -o -type d -print 2> /dev/null | sed 1d | cut -b3-"}" dir=$(eval "$cmd | $(__fzfcmd) +m $FZF_ALT_C_OPTS") && printf 'cd %q' "$dir"}
77 unmodified linesmodified:shell/key-bindings.fish+2 added-2 removed
13 unmodified lines14 end15 16 function fzf-file-widget17 set -q FZF_CTRL_T_COMMAND; or set -l FZF_CTRL_T_COMMAND "18- command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \18+ command find -L . \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \19 -o -type f -print \20 -o -type d -print \21 -o -type l -print 2> /dev/null | sed 1d | cut -b3-"22 eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)" -m $FZF_CTRL_T_OPTS > $TMPDIR/fzf.result"10 unmodified lines33 end34 35 function fzf-cd-widget36 set -q FZF_ALT_C_COMMAND; or set -l FZF_ALT_C_COMMAND "37- command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \37+ command find -L . \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \38 -o -type d -print 2> /dev/null | sed 1d | cut -b3-"39 # Fish hangs if the command before pipe redirects (2> /dev/null)40 eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)" +m $FZF_ALT_C_OPTS > $TMPDIR/fzf.result"41 [ (cat $TMPDIR/fzf.result | wc -l) -gt 0 ]30 unmodified linesmodified:shell/key-bindings.zsh+2 added-2 removed
2 unmodified lines34567789101120 unmodified lines3233343536363738394028 unmodified lines2 unmodified linesif [[ $- == *i* ]]; then
# CTRL-T - Paste the selected file path(s) into the command line__fsel() { local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . \\( -path '*/\\.*' -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 | sed 1d | cut -b3-"}" setopt localoptions pipefail 2> /dev/null20 unmodified linesbindkey '^T' fzf-file-widget
# ALT-C - cd into the selected directoryfzf-cd-widget() { local cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'dev' -o -fstype 'proc' \\) -prune \ local cmd="${FZF_ALT_C_COMMAND:-"command find -L . \\( -path '*/\\.*' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ -o -type d -print 2> /dev/null | sed 1d | cut -b3-"}" setopt localoptions pipefail 2> /dev/null cd "${$(eval "$cmd | $(__fzfcmd) +m $FZF_ALT_C_OPTS"):-.}" local ret=$?28 unmodified lines