Skip to content

Instantly share code, notes, and snippets.

@marr
Created November 14, 2013 23:12
Show Gist options
  • Save marr/7476095 to your computer and use it in GitHub Desktop.
Save marr/7476095 to your computer and use it in GitHub Desktop.
Make up and down arrows search through history of partially typed commands
# Bind the up arrow to history search, instead of history step
"\e[A": history-search-backward
# And the reverse (down)
"\e[B": history-search-forward
@kurahaupo
Copy link

How about using ctrl-up & ctrl-down instead? Like:
"\e[1;5A": history-search-backward
"\e[1;5B": history-search-forward
or alt-up & alt-down:
"\e[1;3A": history-search-backward
"\e[1;3B": history-search-forward
or shift-up & shift-down:
"\e[1;2A": history-search-backward
"\e[1;2B": history-search-forward

For combinations of modifiers: use "\e[1;$(( 1 + (shift?1:0) + (alt?2:0) + (ctrl?4:0) ))A" (or "...B" of course).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment