-
-
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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using the quicker
commandrather thanwhichto see ifpecoinstalled and-rrather thantacetc to reverse the history.