mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
Enable ctrl+R history search via peco
This commit is contained in:
@@ -85,3 +85,25 @@ zle -N zle-line-init
|
|||||||
# use ctrl+t to toggle autosuggestions(hopefully this wont be needed as
|
# use ctrl+t to toggle autosuggestions(hopefully this wont be needed as
|
||||||
# zsh-autosuggestions is designed to be unobtrusive)
|
# zsh-autosuggestions is designed to be unobtrusive)
|
||||||
bindkey '^T' autosuggest-toggle
|
bindkey '^T' autosuggest-toggle
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# History search with peco
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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; then
|
||||||
|
function percol_select_history() {
|
||||||
|
local tac
|
||||||
|
(which gtac &> /dev/null && tac="gtac") || \
|
||||||
|
(which tac &> /dev/null && tac="tac") || \
|
||||||
|
tac="tail -r"
|
||||||
|
BUFFER=$(fc -l -n 1 | eval $tac | peco --query "$LBUFFER")
|
||||||
|
CURSOR=$#BUFFER # move cursor
|
||||||
|
zle -R -c # refresh
|
||||||
|
}
|
||||||
|
|
||||||
|
zle -N percol_select_history
|
||||||
|
bindkey '^R' percol_select_history
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user