X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/blobdiff_plain/816ae2594ec7ada113bf6d5d774bcec70a317338..e45f1c9997c041ec46ec7000f4b4e537eff22ac7:/etc/zsh/.zshrc diff --git a/etc/zsh/.zshrc b/etc/zsh/.zshrc index 90e15a0..4d88417 100644 --- a/etc/zsh/.zshrc +++ b/etc/zsh/.zshrc @@ -200,9 +200,19 @@ for k v (${(kv)a}) { } unset a k v -## other binds +## fzf # bash-style reverse-search-history (i.e. reverse-i-search) -bindkey '^R' history-incremental-pattern-search-backward +if [[ -v commands[fzf] ]] { + function _history-incremental-pattern-search-fzf { + l=(${(f)"$(fc -li -1 0 | fzf -emn 1 +s --preview-window=hidden ${BUFFER:+-q $BUFFER})"}) + l=$(for x ("${l[@]}") { echo ${${=x}:3}; }) + BUFFER="$l" + } + zle -N _history-incremental-pattern-search-fzf + bindkey '^R' _history-incremental-pattern-search-fzf +} else { + bindkey '^R' history-incremental-pattern-search-backward +} ### aliases ## builtins