Skip to content

Instantly share code, notes, and snippets.

@rkaneko
Last active September 12, 2018 04:53
Show Gist options
  • Select an option

  • Save rkaneko/d283bc8b92f1354ce38b0ea8673740ab to your computer and use it in GitHub Desktop.

Select an option

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