Properly support EDITRC - use it as (naming) the file when setting
up libedit, and re-do the config whenever EDITRC is set.
This commit is contained in:
parent
00f36e26a6
commit
3c2922e71c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: histedit.c,v 1.49 2017/06/26 20:28:01 christos Exp $ */
|
||||
/* $NetBSD: histedit.c,v 1.50 2017/06/27 02:22:08 kre Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: histedit.c,v 1.49 2017/06/26 20:28:01 christos Exp $");
|
||||
__RCSID("$NetBSD: histedit.c,v 1.50 2017/06/27 02:22:08 kre Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -158,7 +158,7 @@ bad:
|
||||
el_set(el, EL_EDITOR, "emacs");
|
||||
el_set(el, EL_BIND, "^I",
|
||||
tabcomplete ? "rl-complete" : "ed-insert", NULL);
|
||||
el_source(el, NULL);
|
||||
el_source(el, lookupvar("EDITRC"));
|
||||
}
|
||||
} else {
|
||||
INTOFF;
|
||||
@ -174,6 +174,12 @@ bad:
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
set_editrc(const char *fname)
|
||||
{
|
||||
if (iflag && editing && el)
|
||||
el_source(el, fname);
|
||||
}
|
||||
|
||||
void
|
||||
sethistsize(const char *hs)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: myhistedit.h,v 1.11 2011/06/18 21:18:46 christos Exp $ */
|
||||
/* $NetBSD: myhistedit.h,v 1.12 2017/06/27 02:22:08 kre Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -41,6 +41,7 @@ void histedit(void);
|
||||
void sethistsize(const char *);
|
||||
void setterm(const char *);
|
||||
int inputrc(int, char **);
|
||||
void set_editrc(const char *);
|
||||
int not_fcnumber(char *);
|
||||
int str_to_event(const char *, int);
|
||||
|
||||
|
36
bin/sh/sh.1
36
bin/sh/sh.1
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: sh.1,v 1.152 2017/06/17 07:50:35 kre Exp $
|
||||
.\" $NetBSD: sh.1,v 1.153 2017/06/27 02:22:08 kre Exp $
|
||||
.\" Copyright (c) 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
@ -2750,12 +2750,46 @@ and the default settings in
|
||||
and
|
||||
.Ar vi
|
||||
modes.
|
||||
Also see
|
||||
.Xr editrc 5
|
||||
for the commands that can be given to configure
|
||||
.Xr editline 7
|
||||
in the file named by the
|
||||
.Ev EDITRC
|
||||
parameter, or using
|
||||
.Xr editline 7 Ns \&'s
|
||||
configuration command line.
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width MAILCHECK
|
||||
.It Ev CDPATH
|
||||
The search path used with the
|
||||
.Ic cd
|
||||
built-in.
|
||||
.It Ev EDITRC
|
||||
Gives the name of the file containing commands for
|
||||
.Xr editline 7 .
|
||||
See
|
||||
.Xr editrc 5
|
||||
for possible content and format.
|
||||
The file is processed, when in interactive mode with
|
||||
command line editing enabled, whenever
|
||||
.Ev EDITRC
|
||||
is set (even with no actual value change,)
|
||||
and if command line editing changes from disabled to enabled,
|
||||
or the editor style used is changed.
|
||||
(See the
|
||||
.Fl E
|
||||
and
|
||||
.Fl V
|
||||
options of the
|
||||
.Ic set
|
||||
builtin command, described in
|
||||
.Sx Built-ins
|
||||
above, which are documented further above in
|
||||
.Sx Argument List Processing . )
|
||||
If unset
|
||||
.Dq $HOME/.editrc
|
||||
is used.
|
||||
.It Ev HISTSIZE
|
||||
The number of lines in the history buffer for the shell.
|
||||
.It Ev HOME
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.60 2017/06/17 10:46:34 kre Exp $ */
|
||||
/* $NetBSD: var.c,v 1.61 2017/06/27 02:22:08 kre Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: var.c,v 1.60 2017/06/17 10:46:34 kre Exp $");
|
||||
__RCSID("$NetBSD: var.c,v 1.61 2017/06/27 02:22:08 kre Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -95,6 +95,7 @@ struct localvar *localvars;
|
||||
#ifndef SMALL
|
||||
struct var vhistsize;
|
||||
struct var vterm;
|
||||
struct var editrc;
|
||||
#endif
|
||||
struct var vifs;
|
||||
struct var vmail;
|
||||
@ -139,6 +140,8 @@ const struct varinit varinit[] = {
|
||||
#ifndef SMALL
|
||||
{ &vterm, VSTRFIXED|VTEXTFIXED|VUNSET, "TERM=",
|
||||
{ .set_func= setterm } },
|
||||
{ &editrc, VSTRFIXED|VTEXTFIXED|VUNSET, "EDITRC=",
|
||||
{ .set_func= set_editrc } },
|
||||
#endif
|
||||
{ &voptind, VSTRFIXED|VTEXTFIXED|VNOFUNC, "OPTIND=1",
|
||||
{ .set_func= getoptsreset } },
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.h,v 1.32 2017/06/26 22:09:16 kre Exp $ */
|
||||
/* $NetBSD: var.h,v 1.33 2017/06/27 02:22:08 kre Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -89,6 +89,7 @@ extern struct var vps1;
|
||||
extern struct var vps2;
|
||||
extern struct var vps4;
|
||||
extern struct var line_num;
|
||||
extern struct var editrc;
|
||||
#ifndef SMALL
|
||||
extern struct var vterm;
|
||||
extern struct var vtermcap;
|
||||
|
Loading…
Reference in New Issue
Block a user