cloudposse/geodesic

Bash History Substring Search

RoseSecurity opened this issue · 1 comments

Describe the Feature

How would you feel about adding support for history substring searches?

Use Case

  • GNU Readline has a feature called history-substring-search-backward and history-substring-search-forward where you can type any part of a previously entered command and press the Up or Down Arrow, and it will complete it for you

  • It's possible to do this in ~/.bashrc, and I have tested it in ~/.geodesic/preferences.d/init.sh using:

bind '"\e[A": history-substring-search-backward'
bind '"\e[B": history-substring-search-forward'

Demo

History_Substring_Search.mov
Nuru commented

@RoseSecurity I am disinclined to add this to Geodesic by default, for a few reasons.

  1. These history-substring-search commands are unbound by default in readline
  2. Up-arrow and down-arrow are, by default, bound to previous-history and next-history
  3. You can get practically the same functionality by using reverse-search-history bound to C-r and forward-search-history bound to C-s, which are incremental searches and which default to searching for the last thing searched

All of these bindings are in keeping with the general idea that readline command keystrokes mimic Emacs commands, are intuitive if you are familiar with Emacs, and are available in a surprisingly wide variety of contexts. I think it would be confusing to introduce non-standard behavior by default.

Since on top of that you can reconfigure readline however you want quite easily via ~/.geodesic/preferences.d/init.sh as you have done, I am going to close this request as "wontfix".