Agreed, but even nicer than control-r are the readline functions `history-search-backward` and `history-search-forward`.
Personally I bind them to up/down which on OS X at least involves:
# Put this in some file like ~/.readline-bindings
"\e[A": history-search-backward
"\e[B": history-search-forward
# And this in your ~/.bashrc or ~/.zshrc
bind -f ~/.readline-bindings
That way if you haven't typed any input it behaves like normal up (previous command), but if you've typed some characters it only retrieves matching commands.
Just curious since I don't use a mac, doesn't writing the mappings to .inputrc work? IIRC, putting your readline bindings there makes it available for all readline enabled prompts, not just bash ie: Python, pgsql, mysql,.. Etc
Personally I bind them to up/down which on OS X at least involves:
That way if you haven't typed any input it behaves like normal up (previous command), but if you've typed some characters it only retrieves matching commands.http://codeinthehole.com/writing/the-most-important-command-...
reply