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