diff --git a/zshrc b/zshrc index 2aae63b..39f0ca5 100644 --- a/zshrc +++ b/zshrc @@ -142,6 +142,18 @@ if [[ `uname` = Linux ]]; then [[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line fi +# Fuzzy history search with fzf +function fzf-history-search() { + local selected + selected=`history | sed 's/ *[0-9]* *//' | fzf` + if [[ -n "$selected" ]]; then + BUFFER="$selected" + zle end-of-line + fi +} +zle -N fzf-history-search +bindkey '^R' fzf-history-search + # Enable changing cursor shape based on vi mode if [ "$ITERM_PROFILE" != "" ] && [ "$TMUX" = "" ]; then # iTerm2 cursor shape escape sequences outside tmux