1 .TH LESSKEY 1 "Version 436: 07 Jul 2009"
3 lesskey \- specify key bindings for less
5 .B "lesskey [-o output] [--] [input]"
7 .B "lesskey [--output=output] [--] [input]"
11 .B "lesskey --version"
14 is used to specify a set of key bindings to be used by
16 The input file is a text file which describes the key bindings,
17 If the input file is "-", standard input is read.
18 If no input file is specified, a standard filename is used
19 as the name of the input file, which depends on the system being used:
20 On Unix systems, $HOME/.lesskey is used;
21 on MS-DOS systems, $HOME/_lesskey is used;
22 and on OS/2 systems $HOME/lesskey.ini is used,
23 or $INIT/lesskey.ini if $HOME is undefined.
24 The output file is a binary file which is used by
26 If no output file is specified,
27 and the environment variable LESSKEY is set,
28 the value of LESSKEY is used as the name of the output file.
29 Otherwise, a standard filename is used as the name of the output file,
30 which depends on the system being used:
31 On Unix and OS-9 systems, $HOME/.less is used;
32 on MS-DOS systems, $HOME/_less is used;
33 and on OS/2 systems, $HOME/less.ini is used,
34 or $INIT/less.ini if $HOME is undefined.
35 If the output file already exists,
39 The -V or --version option causes
41 to print its version number and immediately exit.
42 If -V or --version is present, other options and arguments are ignored.
44 The input file consists of one or more
46 Each section starts with a line that identifies the type of section.
47 Possible sections are:
49 Defines new command keys.
51 Defines new line-editing keys.
53 Defines environment variables.
55 Blank lines and lines which start with a pound sign (#) are ignored,
56 except for the special section header lines.
59 The command section begins with the line
63 If the command section is the first section in the file,
64 this line may be omitted.
65 The command section consists of lines of the form:
67 \fIstring\fP <whitespace> \fIaction\fP [extra-string] <newline>
69 Whitespace is any sequence of one or more spaces and/or tabs.
70 The \fIstring\fP is the command key(s) which invoke the action.
71 The \fIstring\fP may be a single command key, or a sequence of up to 15 keys.
72 The \fIaction\fP is the name of the less action, from the list below.
73 The characters in the \fIstring\fP may appear literally, or be
74 prefixed by a caret to indicate a control key.
75 A backslash followed by one to three octal digits may be used to
76 specify a character by its octal value.
77 A backslash followed by certain characters specifies input
78 characters as follows:
108 A backslash followed by any other character indicates that character is
109 to be taken literally.
110 Characters which must be preceded by backslash include
111 caret, space, tab and the backslash itself.
113 An action may be followed by an "extra" string.
114 When such a command is entered while running
116 the action is performed, and then the extra
117 string is parsed, just as if it were typed in to
119 This feature can be used in certain cases to extend
120 the functionality of a command.
121 For example, see the "{" and ":t" commands in the example below.
122 The extra string has a special meaning for the "quit" action:
125 quits, first character of the extra string is used as its exit status.
128 The following input file describes the set of
129 default command keys used by less:
163 \ee\e40 forw-screen-force
200 \een repeat-search-all
202 \eeN reverse-search-all
245 Commands specified by
247 take precedence over the default commands.
248 A default command key may be disabled by including it in the
249 input file with the action "invalid".
250 Alternatively, a key may be defined
251 to do nothing by using the action "noaction".
252 "noaction" is similar to "invalid", but
254 will give an error beep for an "invalid" command,
255 but not for a "noaction" command.
256 In addition, ALL default commands may be disabled by
257 adding this control line to the input file:
261 This will cause all default commands to be ignored.
262 The #stop line should be the last line in that section of the file.
264 Be aware that #stop can be dangerous.
265 Since all default commands are disabled,
266 you must provide sufficient commands before the #stop line
267 to enable all necessary actions.
268 For example, failure to provide a "quit" command can lead to frustration.
270 .SH "LINE EDITING SECTION"
271 The line-editing section begins with the line:
275 This section specifies new key bindings for the line editing commands,
276 in a manner similar to the way key bindings for
277 ordinary commands are specified in the #command section.
278 The line-editing section consists of a list of keys and actions,
279 one per line as in the example below.
282 The following input file describes the set of
283 default line-editing keys used by less:
306 \ee\eb word-backspace
317 .SH "LESS ENVIRONMENT VARIABLES"
318 The environment variable section begins with the line
322 Following this line is a list of environment variable assignments.
323 Each line consists of an environment variable name, an equals sign (=)
324 and the value to be assigned to the environment variable.
325 White space before and after the equals sign is ignored.
326 Variables assigned in this way are visible only to
328 If a variable is specified in the system environment and also in a
329 lesskey file, the value in the lesskey file takes precedence.
330 Although the lesskey file can be used to override variables set in the
331 environment, the main purpose of assigning variables in the lesskey file
332 is simply to have all
334 configuration information stored in one file.
337 The following input file sets the -i option whenever
339 is run, and specifies the character set to be "latin1":
352 It is not possible to specify special keys, such as uparrow,
353 in a keyboard-independent manner.
354 The only way to specify such keys is to specify the escape sequence
355 which a particular keyboard sends when such a key is pressed.
357 On MS-DOS and OS/2 systems, certain keys send a sequence of characters
358 which start with a NUL character (0).
359 This NUL character should be represented as \e340 in a lesskey file.
362 Copyright (C) 2000-2009 Mark Nudelman
364 lesskey is part of the GNU project and is free software;
365 you can redistribute it and/or modify it
366 under the terms of the GNU General Public License as published by
367 the Free Software Foundation;
368 either version 2, or (at your option) any later version.
370 lesskey is distributed in the hope that it will be useful, but
371 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
372 or FITNESS FOR A PARTICULAR PURPOSE.
373 See the GNU General Public License for more details.
375 You should have received a copy of the GNU General Public License
376 along with lesskey; see the file COPYING.
377 If not, write to the Free Software Foundation, 59 Temple Place,
378 Suite 330, Boston, MA 02111-1307, USA.
382 Mark Nudelman <markn@greenwoodsoftware.com>
384 Send bug reports or comments to the above address or to bug-less@gnu.org.