Skip to content
Myr

Merge pull request #122 from blueyed/improve-find-cdwidget

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Improve `find` command for ALT-C: exclude proc/dev

authored by Junegunn Choi · committed by Junegunn Choi · parents 9cb0cdb, 53d5d9d · Browse files · 1 file+13 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−12 removed

  • other:+13 added−12 removed

1 file+13 added−12 removed

modified:install+13 added-12 removed
200 unmodified lines
201 cat >> $src << "EOFZF"202# Key bindings203# ------------204__fsel() {205 command find * -path '*/\.*' -prune \205 command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \206 -o -type f -print \207 -o -type d -print \208 -o -type l -print 2> /dev/null | fzf -m | while read item; do208 -o -type l -print 2> /dev/null | sed 1d | cut -b3- | fzf -m | while read item; do209 printf '%q ' "$item"210 done211 echo212}
12 unmodified lines
225}226227__fcd() {228 local dir229 dir=$(command find -L ${1:-*} -path '*/\.*' -prune -o -type d -print 2> /dev/null | fzf +m) && printf 'cd %q' "$dir"229 dir=$(command find -L ${1:-.} \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \230 -o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m) && printf 'cd %q' "$dir"231}232233__use_tmux=0234[ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ] && __use_tmux=1
39 unmodified lines
274unset __use_tmux275276fi277EOFZF277 else278 else # zsh279 cat >> $src << "EOFZF"280# Key bindings281# ------------282# CTRL-T - Paste the selected file path(s) into the command line283__fsel() {283 set -o nonomatch284 command find * -path '*/\.*' -prune \284 command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \285 -o -type f -print \286 -o -type d -print \287 -o -type l -print 2> /dev/null | fzf -m | while read item; do287 -o -type l -print 2> /dev/null | sed 1d | cut -b3- | fzf -m | while read item; do288 printf '%q ' "$item"289 done290 echo291}
21 unmodified lines
313bindkey '^T' fzf-file-widget314315# ALT-C - cd into the selected directory316fzf-cd-widget() {317 cd "${$(set -o nonomatch; command find -L * -path '*/\.*' -prune \318 -o -type d -print 2> /dev/null | fzf):-.}"317 cd "${$(command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \318 -o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m):-.}"319 zle reset-prompt320}321zle -N fzf-cd-widget322bindkey '\ec' fzf-cd-widget
45 unmodified lines
368 set -g TMPDIR /tmp369 end370371 function __fzf_list372 command find * -path '*/\.*' -prune \372 command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \373 -o -type f -print \374 -o -type d -print \375 -o -type l -print 2> /dev/null375 -o -type l -print 2> /dev/null | sed 1d | cut -b3-376 end377378 function __fzf_list_dir379 command find -L * -path '*/\.*' -prune -o -type d -print 2> /dev/null379 command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) \380 -prune -o -type d -print 2> /dev/null | sed 1d | cut -b3-381 end382383 function __fzf_escape384 while read item
114 unmodified lines