cloudposse / geodesic

🚀 Geodesic is a DevOps Linux Toolbox in Docker
https://cloudposse.com/accelerate
Apache License 2.0
934 stars 118 forks source link

Bash History Substring Search #895

Closed RoseSecurity closed 8 months ago

RoseSecurity commented 9 months ago

Describe the Feature

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

Use Case

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

Demo

https://github.com/cloudposse/geodesic/assets/72598486/4ec9aa99-cdc8-41ff-a945-6b90b7730437

Nuru commented 8 months ago

@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".