Re:Show HN: Sensible Bash: An attempt at saner Bash defaults
by omalsa04 on Wednesday March 02, 2016 @04:15PM
(#11213060)
If you just press "up" without typing anything first then it works as you expect. I find ^R annoying if I've already started typing the command and then realise I can search the history (although that's probably configurable).
Once you get used to it, the only downside of up/down history search is when you ever use a shell that doesn't do it and you feel lost.
Re:Show HN: Sensible Bash: An attempt at saner Bash defaults
by zo1 on Thursday March 03, 2016 @01:08PM
(#11218641)
On a standard Ubuntu install: If you press ^R after already typing part of what you're searching for, and then press a key (space, or more of the command you're searching for), then it'll switch to the history-search mode with that value pre-filled in.
Re:Show HN: Sensible Bash: An attempt at saner Bash defaults
by plorg on Wednesday March 02, 2016 @05:49PM
(#11213689)
I have it as
"\e[5~": history-search-backward
"\e[6~": history-search-forward
This allows you to continue using arrows for absolute chronological history then use PageUp and PageDn for history search.You could also change it to
"\e[5~": history-substring-search-backward
"\e[6~": history-substring-search-forward
if you want to search for a string match anywhere in the command rather than at the beginning. It might be 'substr' rather than 'substring' depending on your Bash version.Obviously the utility of this depends on your keyboard layout and config, as much as it does on personal preferences.
You can see the full list of commands at https://www.gnu.org/software/bash/manual/html_node/Commands-....
Re:Show HN: Sensible Bash: An attempt at saner Bash defaults
by thom_nic on Wednesday March 02, 2016 @10:30PM
(#11214853)
Yup, it changes the default behavior slightly but as @omalsa04 mentioned if you just hit <up> without typing anything it will iterate through the whole command history, the same as it would without this binding.
If I'm trying to semantically query my history (for "ssh") in this case I'll use the ^R binding to incrementally search the history, or literally grep ~/.history for what I'm looking for.
That's not to say that you're "wrong", just that calling these things "sensible defaults" is sort of missing the point. Nothing about them is sensible for everyone.