X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/f7386c50e4c2d2330c7d4fe3c0992911e01be971..e8ae4a469b8b5db19a27a2bf71bb04142a68a6f0:/zsh/lib/fzf.zsh diff --git a/zsh/lib/fzf.zsh b/zsh/lib/fzf.zsh index 7341504..b9188d6 100755 --- a/zsh/lib/fzf.zsh +++ b/zsh/lib/fzf.zsh @@ -1,4 +1,4 @@ -if [[ ! -x /usr/bin/fzf ]]; then +if ! hash fzf 2>/dev/null; then echo '`fzf` is not installed.' return fi @@ -47,7 +47,7 @@ bindkey '^T' fzf-file-widget # ALT-C - cd into the selected directory fzf-cd-widget() { - cd "${$(command find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ + cd "${$(command find -L . -xdev \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ -o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m):-.}" zle reset-prompt } @@ -57,7 +57,7 @@ bindkey '\ec' fzf-cd-widget # CTRL-R - Paste the selected command from history into the command line fzf-history-widget() { local selected - if selected=$(fc -l 1 | fzf -x +s --tac +m -n2..,.. -q "$LBUFFER"); then + if selected=$(fc -l 1 | fzf -x +s --tac +m -n2..,.. --toggle-sort=ctrl-r -q "$LBUFFER"); then num=$(echo "$selected" | head -1 | awk '{print $1}' | sed 's/[^0-9]//g') LBUFFER=!$num zle expand-history