git: 89acef8476ca - stable/13 - sh(1): interactive mode improvement

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Wed, 12 Oct 2022 09:14:02 UTC
The branch stable/13 has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=89acef8476ca01dfebabe4ec7f25c82fb5660fbd

commit 89acef8476ca01dfebabe4ec7f25c82fb5660fbd
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2021-10-19 06:37:47 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2022-10-12 09:13:20 +0000

    sh(1): interactive mode improvement
    
    In the default configuration add 2 bindings which has been requested by
    many during the HEADSUP discussion:
    * csh like arrow history navigation
    * ctrl-arrow to jump from word to words
    
    Add an alias to make the history command exist as an alias to fc -l.
    
    (cherry picked from commit ef0d94a3d34c880bd9f86cd842ee01b6075bc1d8)
---
 bin/sh/dot.shrc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bin/sh/dot.shrc b/bin/sh/dot.shrc
index 5277e5b07b0a..5a111a61a38d 100644
--- a/bin/sh/dot.shrc
+++ b/bin/sh/dot.shrc
@@ -31,6 +31,15 @@
 # alias mv='mv -i'
 # alias rm='rm -i'
 
+# # csh like history on arrow up and down
+bind ^[[A ed-search-prev-history
+bind ^[[B ed-search-next-history
+
+# # ctrl+arrow allow to jump from words to words
+bind "\\e[1;5C" em-next-word
+bind "\\e[1;5D" ed-prev-word
+alias history='fc -l'
+
 # read(2) of directories may not be desirable by default, as this will provoke
 # EISDIR errors from each directory encountered.
 # alias grep='grep -d skip'