Skip to content

Instantly share code, notes, and snippets.

@ramtiga
Created August 24, 2023 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramtiga/66451cbba0e46fdd76f98870f6e74fb1 to your computer and use it in GitHub Desktop.
Save ramtiga/66451cbba0e46fdd76f98870f6e74fb1 to your computer and use it in GitHub Desktop.
test
function peco_select_history() {
local tac
if which tac > /dev/null; then
tac="tac"
else
tac="tail -r"
fi
BUFFER=$(fc -l -n 1 | eval $tac | peco --query "$LBUFFER")
CURSOR=$#BUFFER # move cursor
zle -R -c # refresh
}
zle -N peco_select_history
bindkey '^R' peco_select_history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment