Skip to content

Instantly share code, notes, and snippets.

@rkaneko
Last active September 12, 2018 04:53
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 rkaneko/d283bc8b92f1354ce38b0ea8673740ab to your computer and use it in GitHub Desktop.
Save rkaneko/d283bc8b92f1354ce38b0ea8673740ab to your computer and use it in GitHub Desktop.
Selecting command history extension using peco on bash
export HISTCONTROL="ignoredups"
_peco_select_history() {
local l=$(HISTTIMEFORMAT= history | tac | sed -e 's/^\s*[0-9]*\+\s\+//' | peco --query "$READLINE_LINE")
READLINE_LINE="$l"
READLINE_POINT=${#l}
}
bind -x '"\C-r":_peco_select_history'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment