aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2021-03-30 09:37:29 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2021-03-30 21:49:03 +0000
commit660045fb5360d328da199ae78c89d5cc15b6d1ca (patch)
tree8f56218aec9f64f88e318a3cea9046cadd64f41e /bin
parentb8598e2ff65ab82da0cf6861ee12f078b40bc252 (diff)
downloadsrc-660045fb5360d328da199ae78c89d5cc15b6d1ca.tar.gz
src-660045fb5360d328da199ae78c89d5cc15b6d1ca.zip
sh: improve emacs mode
In emacs mode, force ^R to backware search the history This behaviour is the default in emacs mode for most of the other shells Note: Note that this can still be overridden via $EDITRC, ~/.editrc or a bind command after set -o emacs. MFC after: 1 week Approved by: jilles Reviewed by: jilles, arichardson, pstef Differential Revision: https://reviews.freebsd.org/D29494
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/histedit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 45a821736bc0..ba2bec357181 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -142,8 +142,10 @@ bad:
if (el) {
if (Vflag)
el_set(el, EL_EDITOR, "vi");
- else if (Eflag)
+ else if (Eflag) {
el_set(el, EL_EDITOR, "emacs");
+ el_set(el, EL_BIND, "^R", "em-inc-search-prev", NULL);
+ }
el_set(el, EL_BIND, "^I", "sh-complete", NULL);
el_source(el, NULL);
}