Add fuzzy history search with fzf
This commit is contained in:
parent
1bf5d10b74
commit
a6d97c1eac
12
zshrc
12
zshrc
@ -142,6 +142,18 @@ if [[ `uname` = Linux ]]; then
|
|||||||
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
|
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
|
||||||
fi
|
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
|
# Enable changing cursor shape based on vi mode
|
||||||
if [ "$ITERM_PROFILE" != "" ] && [ "$TMUX" = "" ]; then
|
if [ "$ITERM_PROFILE" != "" ] && [ "$TMUX" = "" ]; then
|
||||||
# iTerm2 cursor shape escape sequences outside tmux
|
# iTerm2 cursor shape escape sequences outside tmux
|
||||||
|
Loading…
x
Reference in New Issue
Block a user