5 ms·
There's a way to configure readline (which bash and many other use) to use up arrow history, like Matlab or Julia do by default, where you hit the up arrow key
by spelufo 3y ago
There's a way to configure readline (which bash and many other use) to use up arrow history, like Matlab or Julia do by default, where you hit the up arrow key to search the history for commands that start with what you've typed so far. It is a small thing, but I use it all the time.
In ~/.inputrc:
"\e[A": history-search-backward
"\C-p": history-search-backward
"\e[B": history-search-forward
"\C-n": history-search-forward
- _0ffh 3y agoAt some point in the past it took me nearly an hour trawling the internet to find this piece of code, though it's not quite identical. "\e[A": history-search-backward "\e[B": history-search-forward "\eOA": history-search-backward "\eOB": history-search-forward The only downside ist, don't over-rely on history muscle memory! Regularly every few months I use p+arrowUp and expect to get "ping" but get the exceptional "pip" instead.
- BeetleB 3y agoIncidentally, many distributions have this enabled, but with the PgUp keybinding instead of Up.
- beaugunderson 3y agowhen I first found this years ago it changed my life. so much faster than ctrl-r to search the history... type a prefix and hit up a few times.
- Ferret7446 3y agoHow is it so much faster? It's only one additional keypress, vs having to reach for the arrow keys.