-
-
Save opennomad/18280decfcabdb7d54e8c257a3a07da3 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 hidden or 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
if [[ "$(command -v peco)" ]]; then | |
# Search shell history with peco: https://github.com/peco/peco | |
# Adapted from: https://github.com/mooz/percol#zsh-history-search | |
function peco_select_history() { | |
BUFFER=$(fc -lnr 1 | peco --initial-filter Regexp --query "$LBUFFER") | |
CURSOR=$#BUFFER # move cursor | |
zle -R -c # refresh | |
} | |
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
Using the quicker
command
rather thanwhich
to see ifpeco
installed and-r
rather thantac
etc to reverse the history.