2 .TH LESSKEY 1 "Version 563: 13 Jun 2020"
4 lesskey \- specify key bindings for less
6 .B "lesskey [\-o output] [\-\-] [input]"
8 .B "lesskey [\-\-output=output] [\-\-] [input]"
12 .B "lesskey \-\-version"
15 is used to specify a set of key bindings to be used by
17 The input file is a text file which describes the key bindings.
18 If the input file is "\-", standard input is read.
19 If no input file is specified, a standard filename is used
20 as the name of the input file, which depends on the system being used:
21 On Unix systems, $HOME/.lesskey is used;
22 on MS-DOS systems, $HOME/_lesskey is used;
23 and on OS/2 systems $HOME/lesskey.ini is used,
24 or $INIT/lesskey.ini if $HOME is undefined.
25 The output file is a binary file which is used by
27 If no output file is specified,
28 and the environment variable LESSKEY is set,
29 the value of LESSKEY is used as the name of the output file.
30 Otherwise, a standard filename is used as the name of the output file,
31 which depends on the system being used:
32 On Unix and OS-9 systems, $HOME/.less is used;
33 on MS-DOS systems, $HOME/_less is used;
34 and on OS/2 systems, $HOME/less.ini is used,
35 or $INIT/less.ini if $HOME is undefined.
36 If the output file already exists,
40 The \-V or \-\-version option causes
42 to print its version number and immediately exit.
43 If \-V or \-\-version is present, other options and arguments are ignored.
45 The input file consists of one or more
47 Each section starts with a line that identifies the type of section.
48 Possible sections are:
50 Defines new command keys.
52 Defines new line-editing keys.
54 Defines environment variables.
56 Blank lines and lines which start with a pound sign (#) are ignored,
57 except for the special section header lines.
60 The command section begins with the line
64 If the command section is the first section in the file,
65 this line may be omitted.
66 The command section consists of lines of the form:
68 \fIstring\fP <whitespace> \fIaction\fP [extra-string] <newline>
70 Whitespace is any sequence of one or more spaces and/or tabs.
71 The \fIstring\fP is the command key(s) which invoke the action.
72 The \fIstring\fP may be a single command key, or a sequence of up to 15 keys.
73 The \fIaction\fP is the name of the less action, from the list below.
74 The characters in the \fIstring\fP may appear literally, or be
75 prefixed by a caret to indicate a control key.
76 A backslash followed by one to three octal digits may be used to
77 specify a character by its octal value.
78 A backslash followed by certain characters specifies input
79 characters as follows:
109 A backslash followed by any other character indicates that character is
110 to be taken literally.
111 Characters which must be preceded by backslash include
112 caret, space, tab and the backslash itself.
114 An action may be followed by an "extra" string.
115 When such a command is entered while running
117 the action is performed, and then the extra
118 string is parsed, just as if it were typed in to
120 This feature can be used in certain cases to extend
121 the functionality of a command.
122 For example, see the "{" and ":t" commands in the example below.
123 The extra string has a special meaning for the "quit" action:
126 quits, first character of the extra string is used as its exit status.
129 The following input file describes the set of
130 default command keys used by less:
166 \ee\e40 forw-screen-force
168 \eeF forw-until-hilite
200 \eeG goto-end-buffered
209 \een repeat-search-all
211 \eeN reverse-search-all
257 Commands specified by
259 take precedence over the default commands.
260 A default command key may be disabled by including it in the
261 input file with the action "invalid".
262 Alternatively, a key may be defined
263 to do nothing by using the action "noaction".
264 "noaction" is similar to "invalid", but
266 will give an error beep for an "invalid" command,
267 but not for a "noaction" command.
268 In addition, ALL default commands may be disabled by
269 adding this control line to the input file:
273 This will cause all default commands to be ignored.
274 The #stop line should be the last line in that section of the file.
276 Be aware that #stop can be dangerous.
277 Since all default commands are disabled,
278 you must provide sufficient commands before the #stop line
279 to enable all necessary actions.
280 For example, failure to provide a "quit" command can lead to frustration.
282 .SH "LINE EDITING SECTION"
283 The line-editing section begins with the line:
287 This section specifies new key bindings for the line editing commands,
288 in a manner similar to the way key bindings for
289 ordinary commands are specified in the #command section.
290 The line-editing section consists of a list of keys and actions,
291 one per line as in the example below.
294 The following input file describes the set of
295 default line-editing keys used by less:
320 \ee\eb word-backspace
333 .SH "LESS ENVIRONMENT VARIABLES"
334 The environment variable section begins with the line
338 Following this line is a list of environment variable assignments.
339 Each line consists of an environment variable name, an equals sign (=)
340 and the value to be assigned to the environment variable.
341 White space before and after the equals sign is ignored.
342 Variables assigned in this way are visible only to
344 If a variable is specified in the system environment and also in a
345 lesskey file, the value in the lesskey file takes precedence.
346 Although the lesskey file can be used to override variables set in the
347 environment, the main purpose of assigning variables in the lesskey file
348 is simply to have all
350 configuration information stored in one file.
353 The following input file sets the \-i option whenever
355 is run, and specifies the character set to be "latin1":
368 On MS-DOS and OS/2 systems, certain keys send a sequence of characters
369 which start with a NUL character (0).
370 This NUL character should be represented as \e340 in a lesskey file.
373 Copyright (C) 1984-2020 Mark Nudelman
375 less is part of the GNU project and is free software.
376 You can redistribute it and/or modify it
377 under the terms of either
378 (1) the GNU General Public License as published by
379 the Free Software Foundation; or (2) the Less License.
380 See the file README in the less distribution for more details
381 regarding redistribution.
382 You should have received a copy of the GNU General Public License
383 along with the source for less; see the file COPYING.
384 If not, write to the Free Software Foundation, 59 Temple Place,
385 Suite 330, Boston, MA 02111-1307, USA.
386 You should also have received a copy of the Less License;
387 see the file LICENSE.
389 less is distributed in the hope that it will be useful, but
390 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
391 or FITNESS FOR A PARTICULAR PURPOSE.
392 See the GNU General Public License for more details.
398 Send bug reports or comments to <bug-less@gnu.org>.