Last active
August 29, 2015 14:16
-
-
Save waltarix/93535792ad9cc3e9e709 to your computer and use it in GitHub Desktop.
peco_select_history for zsh
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
# vim:ft=zsh | |
whence peco &>/dev/null && function { | |
function peco_select_history { | |
emulate -L zsh | |
local delimiter=$'\0; \0' newline=$'\n' | |
BUFFER=${"$(print -rl ${history//$newline/$delimiter} | peco --query "$LBUFFER")"//$delimiter/$newline} | |
CURSOR=$#BUFFER | |
zle -Rc | |
zle reset-prompt | |
} | |
zle -N peco_select_history | |
bindkey "^Xh" peco_select_history | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment