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
This commit is contained in:
Baptiste Daroussin 2021-03-30 11:37:29 +02:00
parent b8598e2ff6
commit 660045fb53

View File

@ -142,8 +142,10 @@ histedit(void)
if (el) { if (el) {
if (Vflag) if (Vflag)
el_set(el, EL_EDITOR, "vi"); el_set(el, EL_EDITOR, "vi");
else if (Eflag) else if (Eflag) {
el_set(el, EL_EDITOR, "emacs"); 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_set(el, EL_BIND, "^I", "sh-complete", NULL);
el_source(el, NULL); el_source(el, NULL);
} }