version 1.5, 2003/08/18 17:21:45 |
version 1.6, 2003/11/30 14:05:29 |
|
|
.\" 1. Redistributions of source code must retain the above copyright |
.\" 1. Redistributions of source code must retain the above copyright |
.\" notice, this list of conditions and the following disclaimer. |
.\" notice, this list of conditions and the following disclaimer. |
.\" 2. Redistributions in binary form must reproduce the above copyright |
.\" 2. Redistributions in binary form must reproduce the above copyright |
.\" notice in the documentation and/or other materials provided with |
.\" notice in the documentation and/or other materials provided with |
.\" the distribution. |
.\" the distribution. |
.\" |
.\" |
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY |
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY |
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE |
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE |
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
.\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
.Dd January 17, 2003 |
.Dd January 17, 2003 |
.Dt LESSKEY 1 |
.Dt LESSKEY 1 |
|
|
.Nd specify key bindings for less |
.Nd specify key bindings for less |
.Sh SYNOPSIS |
.Sh SYNOPSIS |
.Nm lesskey |
.Nm lesskey |
.Op Fl o Ar output |
.Oo Fl o Ar output |
.Op Fl - |
.Pf " | " Fl -output Ns = Ns Ar output Oc |
.Op Ar input |
.Op Ar input |
.Nm lesskey |
.Nm lesskey |
.Op Fl -output Ns No = Ns Ar output |
.Fl V | -version |
.Op Fl - |
|
.Op Ar input |
|
.Nm lesskey |
|
.Fl V |
|
.Nm lesskey |
|
.Fl -version |
|
.Sh DESCRIPTION |
.Sh DESCRIPTION |
.Nm |
.Nm |
is used to specify a set of key bindings to be used by |
is used to specify a set of key bindings to be used by |
.Xr less 1 . |
.Xr less 1 . |
The input file is a text file which describes the key bindings. |
The input file is a text file which describes the key bindings. |
If the input file is "-", standard input is read. |
If the input file is |
|
.Sq - , |
|
standard input is read. |
If no input file is specified, a standard filename is used |
If no input file is specified, a standard filename is used |
as the name of the input file, which depends on the system being used: |
as the name of the input file; by default |
On Unix systems, $HOME/.lesskey is used. |
.Pa $HOME/.lesskey . |
.\" on MS-DOS systems, $HOME/_lesskey is used; |
.\" on MS-DOS systems, $HOME/_lesskey is used; |
.\" and on OS/2 systems $HOME/lesskey.ini is used, |
.\" and on OS/2 systems $HOME/lesskey.ini is used, |
.\" or $INIT/lesskey.ini if $HOME is undefined. |
.\" or $INIT/lesskey.ini if $HOME is undefined. |
The output file is a binary file which is used by less. |
The output file is a binary file which is used by |
|
.Xr less 1 . |
If no output file is specified, and the environment variable |
If no output file is specified, and the environment variable |
.Ev LESSKEY |
.Ev LESSKEY |
is set, the value of LESSKEY is used as the name of the output file. |
is set, the value of |
Otherwise, a standard filename is used as the name of the output file, |
.Ev LESSKEY |
which depends on the system being used: |
is used as the name of the output file. |
On Unix and OS-9 systems, $HOME/.less is used. |
Otherwise, a standard filename is used as the name of the output file; |
|
by default |
|
.Pa $HOME/.less |
|
is used. |
.\" on MS-DOS systems, $HOME/_less is used; |
.\" on MS-DOS systems, $HOME/_less is used; |
.\" and on OS/2 systems, $HOME/less.ini is used, |
.\" and on OS/2 systems, $HOME/less.ini is used, |
.\" or $INIT/less.ini if $HOME is undefined. |
.\" or $INIT/less.ini if $HOME is undefined. |
|
|
.Nm |
.Nm |
will overwrite it. |
will overwrite it. |
.Pp |
.Pp |
The -V or --version option causes |
A system-wide lesskey file may also be set up to provide key bindings. |
|
If a key is defined in both a local lesskey file and in the |
|
system-wide file, key bindings in the local file take precedence over |
|
those in the system-wide file. |
|
If the environment variable |
|
.Ev LESSKEY_SYSTEM |
|
is set, |
|
.Xr less 1 |
|
uses that as the name of the system-wide lesskey file. |
|
Otherwise, |
|
.Xr less 1 |
|
looks in a standard place for the system-wide lesskey file: |
|
On |
|
.Ox , |
|
the system-wide lesskey file is |
|
.Pa /etc/sysless . |
|
.Pp |
|
The |
|
.Fl V |
|
or |
|
.Fl -version |
|
option causes |
.Nm |
.Nm |
to print its version number and immediately exit. |
to print its version number and immediately exit. |
If -V or --version is present, other options and arguments are ignored. |
If |
|
.Fl V |
|
or |
|
.Fl -version |
|
is present, other options and arguments are ignored. |
.Pp |
.Pp |
The input file consists of one or more sections. |
The input file consists of one or more sections. |
Each section starts with a line that identifies the type of section. |
Each section starts with a line that identifies the type of section. |
Possible sections are: |
Possible sections are: |
.Bl -tag -width "#line-edit" |
.Bl -tag -width "#line-edit" -offset indent |
.It #command |
.It #command |
Defines new command keys. |
Defines new command keys. |
.It #line-edit |
.It #line-edit |
|
|
If the command section is the first section in the file, |
If the command section is the first section in the file, |
this line may be omitted. |
this line may be omitted. |
The command section consists of lines of the form: |
The command section consists of lines of the form: |
|
.Bd -filled -offset indent |
|
.Ar string |
|
.Aq whitespace |
|
.Ar action |
|
.Bq extra-string |
|
.Aq newline |
|
.Ed |
.Pp |
.Pp |
.Xo |
|
.Ar \& string No <whitespace> |
|
.Ar action No [extra-string] <newline> |
|
.Xc |
|
.Pp |
|
Whitespace is any sequence of one or more spaces and/or tabs. |
Whitespace is any sequence of one or more spaces and/or tabs. |
The |
The |
.Ar string |
.Ar string |
|
|
specify a character by its octal value. |
specify a character by its octal value. |
A backslash followed by certain characters specifies input |
A backslash followed by certain characters specifies input |
characters as follows: |
characters as follows: |
.Bl -tag -width Ds |
.Pp |
|
.Bl -tag -width Ds -offset indent -compact |
.It \eb |
.It \eb |
BACKSPACE |
BACKSPACE |
.It \ee |
.It \ee |
|
|
Characters which must be preceded by backslash include |
Characters which must be preceded by backslash include |
caret, space, tab and the backslash itself. |
caret, space, tab and the backslash itself. |
.Pp |
.Pp |
An action may be followed by an "extra" string. |
An action may be followed by an |
|
.Qq extra |
|
string. |
When such a command is entered while running less, |
When such a command is entered while running less, |
the action is performed, and then the extra |
the action is performed, and then the extra |
string is parsed, just as if it were typed in to less. |
string is parsed, just as if it were typed in to less. |
This feature can be used in certain cases to extend |
This feature can be used in certain cases to extend |
the functionality of a command. |
the functionality of a command. |
For example, see the "{" and ":t" commands in the example below. |
For example, see the |
The extra string has a special meaning for the "quit" action: |
.Sq { |
|
and |
|
.Sq :t |
|
commands in the example below. |
|
The extra string has a special meaning for the |
|
.Qq quit |
|
action: |
when less quits, |
when less quits, |
first character of the extra string is used as its exit status. |
first character of the extra string is used as its exit status. |
.Sh EXAMPLE |
.Pp |
The following input file describes the set of |
The following input file describes the set of |
default command keys used by less: |
default command keys used by less: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
|
|
.Nm |
.Nm |
take precedence over the default commands. |
take precedence over the default commands. |
A default command key may be disabled by including it in the |
A default command key may be disabled by including it in the |
input file with the action "invalid". |
input file with the action |
|
.Qq invalid . |
Alternatively, a key may be defined |
Alternatively, a key may be defined |
to do nothing by using the action "noaction". |
to do nothing by using the action |
"noaction" is similar to "invalid", but |
.Qq noaction . |
less will give an error beep for an "invalid" command, |
.Qq noaction |
but not for a "noaction" command. |
is similar to |
|
.Qq invalid , |
|
but less will give an error beep for an |
|
.Qq invalid |
|
command, but not for a |
|
.Qq noaction |
|
command. |
In addition, ALL default commands may be disabled by |
In addition, ALL default commands may be disabled by |
adding this control line to the input file: |
adding this control line to the input file: |
.Pp |
.Pp |
|
|
Be aware that #stop can be dangerous. |
Be aware that #stop can be dangerous. |
Since all default commands are disabled, you must provide sufficient |
Since all default commands are disabled, you must provide sufficient |
commands before the #stop line to enable all necessary actions. |
commands before the #stop line to enable all necessary actions. |
For example, failure to provide a "quit" command can lead to frustration. |
For example, failure to provide a |
|
.Qq quit |
|
command can lead to frustration. |
.Sh LINE EDITING SECTION |
.Sh LINE EDITING SECTION |
The line-editing section begins with the line: |
The line-editing section begins with the line: |
.Pp |
.Pp |
|
|
ordinary commands are specified in the #command section. |
ordinary commands are specified in the #command section. |
The line-editing section consists of a list of keys and actions, |
The line-editing section consists of a list of keys and actions, |
one per line as in the example below. |
one per line as in the example below. |
.Sh EXAMPLE |
.Pp |
The following input file describes the set of |
The following input file describes the set of |
default line-editing keys used by less: |
default line-editing keys used by less: |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
|
|
\eku up |
\eku up |
\eej down |
\eej down |
.Ed |
.Ed |
.Sh LESS ENVIRONMENT VARIABLES |
.Sh ENVIRONMENT SECTION |
The environment variable section begins with the line |
The environment variable section begins with the line |
.Pp |
.Pp |
.Dl #env |
.Dl #env |
.Pp |
.Pp |
Following this line is a list of environment variable assignments. |
Following this line is a list of environment variable assignments. |
Each line consists of an environment variable name, an equals sign (=) |
Each line consists of an environment variable name, an equals sign |
|
.Pq Sq = |
and the value to be assigned to the environment variable. |
and the value to be assigned to the environment variable. |
Whitespace before and after the equals sign is ignored. |
Whitespace before and after the equals sign is ignored. |
Variables assigned in this way are visible only to less. |
Variables assigned in this way are visible only to less. |
If a variable is specified in the system environment and also in a |
If environment variables are defined in more than one place, |
lesskey file, the value in the lesskey file takes precedence. |
variables defined in a local lesskey file take precedence over |
|
variables defined in the system environment, which take precedence |
|
over variables defined in the system-wide lesskey file. |
Although the lesskey file can be used to override variables set in the |
Although the lesskey file can be used to override variables set in the |
environment, the main purpose of assigning variables in the lesskey file |
environment, the main purpose of assigning variables in the lesskey file |
is simply to have all less configuration information stored in one file. |
is simply to have all less configuration information stored in one file. |
.Sh EXAMPLE |
.Pp |
The following input file sets the -i option whenever less is run, |
The following input file sets the -i option whenever less is run, |
and specifies the character set to be "latin1": |
and specifies the character set to be |
|
.Qq latin1 : |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
#env |
#env |
LESS = -i |
LESS = -i |
LESSCHARSET = latin1 |
LESSCHARSET = latin1 |
.Ed |
.Ed |
|
.Sh ENVIRONMENT |
|
.Bl -tag -width LESSKEY_SYSTEM -compact |
|
.It Ev LESSKEY |
|
Name of the default |
|
.Nm |
|
file. |
|
.It Ev LESSKEY_SYSTEM |
|
Name of the default system-wide |
|
.Nm |
|
file. |
|
.El |
|
.Sh FILES |
|
.Bl -tag -width "$HOME/.lesskey" -compact |
|
.It $HOME/.less |
|
Default |
|
.Nm |
|
file. |
|
.It $HOME/.lesskey |
|
Default |
|
.Nm |
|
input file. |
|
.It /etc/sysless |
|
Default system-wide |
|
.Nm |
|
file. |
|
.El |
.Sh SEE ALSO |
.Sh SEE ALSO |
.Xr less 1 |
.Xr less 1 |
.Sh WARNINGS |
.Sh AUTHORS |
|
.An Mark Nudelman Aq markn@greenwoodsoftware.com |
|
.Pp |
|
Send bug reports or comments to the above address or to |
|
.Aq bug\-less@gnu.org . |
|
.Sh CAVEATS |
It is not possible to specify special keys, such as uparrow, |
It is not possible to specify special keys, such as uparrow, |
in a keyboard-independent manner. |
in a keyboard-independent manner. |
The only way to specify such keys is to specify the escape sequence |
The only way to specify such keys is to specify the escape sequence |
|
|
notice, this list of conditions and the following disclaimer. |
notice, this list of conditions and the following disclaimer. |
.It |
.It |
Redistributions in binary form must reproduce the above copyright |
Redistributions in binary form must reproduce the above copyright |
notice in the documentation and/or other materials provided with |
notice in the documentation and/or other materials provided with |
the distribution. |
the distribution. |
.El |
.El |
.Pp |
.Pp |
THIS SOFTWARE IS PROVIDED BY THE AUTHOR |
THIS SOFTWARE IS PROVIDED BY THE AUTHOR |
.Dq AS IS |
.Dq AS IS |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE |
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
.Sh AUTHORS |
|
.An Mark Nudelman Aq markn@greenwoodsoftware.com |
|
.Pp |
|
Send bug reports or comments to the above address or to |
|
.Aq bug-less@gnu.org . |
|