feat: disable plugin if fzf is not installed
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
fzf_history_seach() {
|
||||
# do nothing if fzf is not installed
|
||||
(( ! $+commands[fzf] )) && return
|
||||
|
||||
fzf_history_search() {
|
||||
setopt extendedglob
|
||||
candidates=(${(f)"$(fc -li -1 0 | fzf +s +m -x -e -q "$BUFFER")"})
|
||||
BUFFER="${candidates[@]/(#m)*/${${(As: :)MATCH}[4,-1]}}"
|
||||
@@ -7,7 +10,7 @@ fzf_history_seach() {
|
||||
zle end-of-buffer-or-history
|
||||
}
|
||||
|
||||
autoload fzf_history_seach
|
||||
zle -N fzf_history_seach
|
||||
autoload fzf_history_search
|
||||
zle -N fzf_history_search
|
||||
|
||||
bindkey '^r' fzf_history_seach
|
||||
bindkey '^r' fzf_history_search
|
||||
|
||||
Reference in New Issue
Block a user