diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index c429d91..eccc826 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -37,7 +37,8 @@ bindkey '\ec' fzf-cd-widget # CTRL-R - Paste the selected command from history into the command line fzf-history-widget() { local selected num - if selected=( $(fc -l 1 | $(__fzfcmd) +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r -q "$LBUFFER") ); then + selected=( $(fc -l 1 | $(__fzfcmd) +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r -q "$LBUFFER") ) + if [ -n "$selected" ]; then num=$selected[1] if [ -n "$num" ]; then zle vi-fetch-history -n $num