Forked from jimeh/zsh-history-search-with-peco.zsh
Last active
April 29, 2016 05:17
-
-
Save Jessidhia/2a40539515bbdcb4c86f0b1e4282cde2 to your computer and use it in GitHub Desktop.
Use peco (https://github.com/peco/peco) to search ZSH's history via ctrl+R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Search shell history with peco: https://github.com/peco/peco | |
# Adapted from: https://github.com/mooz/percol#zsh-history-search | |
if [ "$(which peco &>/dev/null && echo 'a' | peco --select-1)" = 'a' ]; then | |
function peco_select_history() { | |
local lbuf="$LBUFFER" | |
BUFFER= | |
zle -c -U "$(print -rl - $history | peco --layout=bottom-up --query "$lbuf")" | |
} | |
zle -N peco_select_history | |
bindkey '^R' peco_select_history | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made to work with zsh 5.2 (
zle -l
can't be used in zle widgets)