1 .\" $OpenBSD: lesskey.1,v 1.15 2015/11/23 12:56:13 tb Exp $
3 .\" Copyright (C) 2000-2012 Mark Nudelman
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice in the documentation and/or other materials provided with
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
15 .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
20 .\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
24 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 .Dd $Mdocdate: November 23 2015 $
30 .Nd specify key bindings for less
34 .Pf " | " Fl -output Ns = Ns Ar output Oc
40 is used to specify a set of key bindings to be used by
42 The input file is a text file which describes the key bindings.
45 standard input is read.
46 If no input file is specified, a standard filename is used
47 as the name of the input file; by default
49 .\" on MS-DOS systems, $HOME/_lesskey is used;
50 .\" and on OS/2 systems $HOME/lesskey.ini is used,
51 .\" or $INIT/lesskey.ini if $HOME is undefined.
52 The output file is a binary file which is used by
54 If no output file is specified, and the environment variable
58 is used as the name of the output file.
59 Otherwise, a standard filename is used as the name of the output file;
63 .\" on MS-DOS systems, $HOME/_less is used;
64 .\" and on OS/2 systems, $HOME/less.ini is used,
65 .\" or $INIT/less.ini if $HOME is undefined.
66 If the output file already exists,
70 A system-wide lesskey file may also be set up to provide key bindings.
71 If a key is defined in both a local lesskey file and in the
72 system-wide file, key bindings in the local file take precedence over
73 those in the system-wide file.
74 If the environment variable
78 uses that as the name of the system-wide lesskey file.
81 looks in a standard place for the system-wide lesskey file:
84 the system-wide lesskey file is
93 to print its version number and immediately exit.
98 is present, other options and arguments are ignored.
100 The input file consists of one or more sections.
101 Each section starts with a line that identifies the type of section.
102 Possible sections are:
103 .Bl -tag -width "#line-edit" -offset indent
105 Defines new command keys.
107 Defines new line-editing keys.
109 Defines environment variables.
112 Blank lines and lines which start with a pound sign (#) are ignored,
113 except for the special section header lines.
115 The command section begins with the line
119 If the command section is the first section in the file,
120 this line may be omitted.
121 The command section consists of lines of the form:
122 .Bd -filled -offset indent
130 Whitespace is any sequence of one or more spaces and/or tabs.
133 is the command key(s) which invoke the action.
136 may be a single command key, or a sequence of up to 15 keys.
139 is the name of the less action, from the list below.
140 The characters in the
142 may appear literally, or be prefixed by a caret to indicate a control key.
143 A backslash followed by one to three octal digits may be used to
144 specify a character by its octal value.
145 A backslash followed by certain characters specifies input
146 characters as follows:
148 .Bl -tag -width Ds -offset indent -compact
179 A backslash followed by any other character indicates that character is
180 to be taken literally.
181 Characters which must be preceded by backslash include
182 caret, space, tab and the backslash itself.
184 An action may be followed by an
187 When such a command is entered while running less,
188 the action is performed, and then the extra
189 string is parsed, just as if it were typed in to less.
190 This feature can be used in certain cases to extend
191 the functionality of a command.
196 commands in the example below.
197 The extra string has a special meaning for the
201 first character of the extra string is used as its exit status.
203 The following input file describes the set of
204 default command keys used by less:
205 .Bd -literal -offset indent
237 \ee\e40 forw-screen-force
239 \eeF forw-until-hilite
275 \een repeat-search-all
277 \eeN reverse-search-all
319 Commands specified by
321 take precedence over the default commands.
322 A default command key may be disabled by including it in the
323 input file with the action
325 Alternatively, a key may be defined
326 to do nothing by using the action
331 but less will give an error beep for an
333 command, but not for a
336 In addition, ALL default commands may be disabled by
337 adding this control line to the input file:
341 This will cause all default commands to be ignored.
342 The #stop line should be the last line in that section of the file.
344 Be aware that #stop can be dangerous.
345 Since all default commands are disabled, you must provide sufficient
346 commands before the #stop line to enable all necessary actions.
347 For example, failure to provide a
349 command can lead to frustration.
350 .Sh LINE EDITING SECTION
351 The line-editing section begins with the line:
355 This section specifies new key bindings for the line editing commands,
356 in a manner similar to the way key bindings for
357 ordinary commands are specified in the #command section.
358 The line-editing section consists of a list of keys and actions,
359 one per line as in the example below.
361 The following input file describes the set of
362 default line-editing keys used by less:
363 .Bd -literal -offset indent
384 \ee\eb word-backspace
394 .Sh ENVIRONMENT SECTION
395 The environment variable section begins with the line
399 Following this line is a list of environment variable assignments.
400 Each line consists of an environment variable name, an equals sign
402 and the value to be assigned to the environment variable.
403 Whitespace before and after the equals sign is ignored.
404 Variables assigned in this way are visible only to less.
405 If environment variables are defined in more than one place,
406 variables defined in a local lesskey file take precedence over
407 variables defined in the system environment, which take precedence
408 over variables defined in the system-wide lesskey file.
409 Although the lesskey file can be used to override variables set in the
410 environment, the main purpose of assigning variables in the lesskey file
411 is simply to have all less configuration information stored in one file.
413 The following input file sets the -i option whenever less is run:
414 .Bd -literal -offset indent
419 .Bl -tag -width LESSKEY_SYSTEM -compact
424 .It Ev LESSKEY_SYSTEM
425 Name of the default system-wide
430 .Bl -tag -width "$HOME/.lesskey" -compact