Add a `bind' builtin command, which is simply a wrapper around libedit's
builtin command of the same name. This allows the key bindings for the shell's line editor to be changed. MFC after: 2 weeks
This commit is contained in:
parent
95ad74d7cf
commit
088acf9001
@ -92,3 +92,4 @@ waitcmd wait
|
|||||||
aliascmd alias
|
aliascmd alias
|
||||||
ulimitcmd ulimit
|
ulimitcmd ulimit
|
||||||
testcmd test [
|
testcmd test [
|
||||||
|
bindcmd bind
|
||||||
|
@ -480,6 +480,16 @@ str_to_event(char *str, int last)
|
|||||||
}
|
}
|
||||||
return (he.num);
|
return (he.num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
bindcmd(int argc, char **argv)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (el == NULL)
|
||||||
|
error("line editing is disabled");
|
||||||
|
return (el_parse(el, argc, argv));
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
@ -491,4 +501,12 @@ histcmd(int argc, char **argv)
|
|||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
bindcmd(int argc, char **argv)
|
||||||
|
{
|
||||||
|
|
||||||
|
error("not compiled with line editing support");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,4 +45,5 @@ void sethistsize(const char *);
|
|||||||
int histcmd(int, char **);
|
int histcmd(int, char **);
|
||||||
int not_fcnumber(char *);
|
int not_fcnumber(char *);
|
||||||
int str_to_event(char *, int);
|
int str_to_event(char *, int);
|
||||||
|
int bindcmd(int, char **);
|
||||||
|
|
||||||
|
@ -1279,6 +1279,10 @@ Execute the specified builtin command,
|
|||||||
.Ar cmd .
|
.Ar cmd .
|
||||||
This is useful when the user wishes to override a shell function
|
This is useful when the user wishes to override a shell function
|
||||||
with the same name as a builtin command.
|
with the same name as a builtin command.
|
||||||
|
.It Ic bind Oo Fl aeklrsv Oc Oo Ar key Oo Ar command Oc Oc
|
||||||
|
List or alter key bindings for the line editor.
|
||||||
|
This command is documented in
|
||||||
|
.Xr editrc 5 .
|
||||||
.It Ic cd Oo Fl LP Oc Op Ar directory
|
.It Ic cd Oo Fl LP Oc Op Ar directory
|
||||||
Switch to the specified
|
Switch to the specified
|
||||||
.Ar directory ,
|
.Ar directory ,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user