Import less-436.
[dragonfly.git] / contrib / less / lesskey.nro
CommitLineData
a9adbba3 1.TH LESSKEY 1 "Version 436: 07 Jul 2009"
131ccf9c
PA
2.SH NAME
3lesskey \- specify key bindings for less
4.SH SYNOPSIS
5.B "lesskey [-o output] [--] [input]"
6.br
7.B "lesskey [--output=output] [--] [input]"
8.br
9.B "lesskey -V"
10.br
11.B "lesskey --version"
12.SH DESCRIPTION
13.I Lesskey
14is used to specify a set of key bindings to be used by
15.I less.
16The input file is a text file which describes the key bindings,
17If the input file is "-", standard input is read.
18If no input file is specified, a standard filename is used
19as the name of the input file, which depends on the system being used:
20On Unix systems, $HOME/.lesskey is used;
21on MS-DOS systems, $HOME/_lesskey is used;
22and on OS/2 systems $HOME/lesskey.ini is used,
23or $INIT/lesskey.ini if $HOME is undefined.
24The output file is a binary file which is used by
25.I less.
26If no output file is specified,
27and the environment variable LESSKEY is set,
28the value of LESSKEY is used as the name of the output file.
29Otherwise, a standard filename is used as the name of the output file,
30which depends on the system being used:
31On Unix and OS-9 systems, $HOME/.less is used;
32on MS-DOS systems, $HOME/_less is used;
33and on OS/2 systems, $HOME/less.ini is used,
34or $INIT/less.ini if $HOME is undefined.
35If the output file already exists,
36.I lesskey
37will overwrite it.
38.PP
39The -V or --version option causes
40.I lesskey
41to print its version number and immediately exit.
42If -V or --version is present, other options and arguments are ignored.
43.PP
44The input file consists of one or more
45.I sections.
46Each section starts with a line that identifies the type of section.
47Possible sections are:
48.IP #command
49Defines new command keys.
50.IP #line-edit
51Defines new line-editing keys.
52.IP #env
53Defines environment variables.
54.PP
55Blank lines and lines which start with a pound sign (#) are ignored,
56except for the special section header lines.
57
58.SH "COMMAND SECTION"
59The command section begins with the line
60.sp
61#command
62.sp
63If the command section is the first section in the file,
64this line may be omitted.
65The command section consists of lines of the form:
66.sp
67 \fIstring\fP <whitespace> \fIaction\fP [extra-string] <newline>
68.sp
69Whitespace is any sequence of one or more spaces and/or tabs.
70The \fIstring\fP is the command key(s) which invoke the action.
71The \fIstring\fP may be a single command key, or a sequence of up to 15 keys.
72The \fIaction\fP is the name of the less action, from the list below.
73The characters in the \fIstring\fP may appear literally, or be
74prefixed by a caret to indicate a control key.
75A backslash followed by one to three octal digits may be used to
76specify a character by its octal value.
77A backslash followed by certain characters specifies input
78characters as follows:
79.IP \eb
80BACKSPACE
81.IP \ee
82ESCAPE
83.IP \en
84NEWLINE
85.IP \er
86RETURN
87.IP \et
88TAB
89.IP \eku
90UP ARROW
91.IP \ekd
92DOWN ARROW
93.IP \ekr
94RIGHT ARROW
95.IP \ekl
96LEFT ARROW
97.IP \ekU
98PAGE UP
99.IP \ekD
100PAGE DOWN
101.IP \ekh
102HOME
103.IP \eke
104END
105.IP \ekx
106DELETE
107.PP
108A backslash followed by any other character indicates that character is
109to be taken literally.
110Characters which must be preceded by backslash include
111caret, space, tab and the backslash itself.
112.PP
113An action may be followed by an "extra" string.
114When such a command is entered while running
115.I less,
116the action is performed, and then the extra
117string is parsed, just as if it were typed in to
118.I less.
119This feature can be used in certain cases to extend
120the functionality of a command.
121For example, see the "{" and ":t" commands in the example below.
122The extra string has a special meaning for the "quit" action:
123when
124.I less
125quits, first character of the extra string is used as its exit status.
126
127.SH EXAMPLE
128The following input file describes the set of
129default command keys used by less:
130.sp
131.nf
132 #command
133 \er forw-line
134 \en forw-line
135 e forw-line
136 j forw-line
137 \ekd forw-line
138 ^E forw-line
139 ^N forw-line
140 k back-line
141 y back-line
142 ^Y back-line
143 ^K back-line
144 ^P back-line
145 J forw-line-force
146 K back-line-force
147 Y back-line-force
148 d forw-scroll
149 ^D forw-scroll
150 u back-scroll
151 ^U back-scroll
152 \e40 forw-screen
153 f forw-screen
154 ^F forw-screen
155 ^V forw-screen
156 \ekD forw-screen
157 b back-screen
158 ^B back-screen
159 \eev back-screen
160 \ekU back-screen
161 z forw-window
162 w back-window
163 \ee\e40 forw-screen-force
164 F forw-forever
165 R repaint-flush
166 r repaint
167 ^R repaint
168 ^L repaint
169 \eeu undo-hilite
170 g goto-line
171 \ekh goto-line
172 < goto-line
173 \ee< goto-line
174 p percent
175 % percent
176 \ee[ left-scroll
177 \ee] right-scroll
178 \ee( left-scroll
179 \ee) right-scroll
180 { forw-bracket {}
181 } back-bracket {}
182 ( forw-bracket ()
183 ) back-bracket ()
184 [ forw-bracket []
185 ] back-bracket []
186 \ee^F forw-bracket
187 \ee^B back-bracket
188 G goto-end
189 \ee> goto-end
190 > goto-end
191 \eke goto-end
192 = status
193 ^G status
194 :f status
195 / forw-search
196 ? back-search
197 \ee/ forw-search *
198 \ee? back-search *
199 n repeat-search
200 \een repeat-search-all
201 N reverse-search
202 \eeN reverse-search-all
8be36e5b 203 & filter
131ccf9c
PA
204 m set-mark
205 ' goto-mark
206 ^X^X goto-mark
207 E examine
208 :e examine
209 ^X^V examine
210 :n next-file
211 :p prev-file
212 t next-tag
213 T prev-tag
214 :x index-file
215 :d remove-file
216 - toggle-option
217 :t toggle-option t
218 s toggle-option o
219 _ display-option
220 | pipe
221 v visual
222 ! shell
223 + firstcmd
224 H help
225 h help
226 V version
227 0 digit
228 1 digit
229 2 digit
230 3 digit
231 4 digit
232 5 digit
233 6 digit
234 7 digit
235 8 digit
236 9 digit
237 q quit
238 Q quit
239 :q quit
240 :Q quit
241 ZZ quit
242.fi
243.sp
244.SH PRECEDENCE
245Commands specified by
246.I lesskey
247take precedence over the default commands.
248A default command key may be disabled by including it in the
249input file with the action "invalid".
250Alternatively, a key may be defined
251to do nothing by using the action "noaction".
252"noaction" is similar to "invalid", but
253.I less
254will give an error beep for an "invalid" command,
255but not for a "noaction" command.
256In addition, ALL default commands may be disabled by
257adding this control line to the input file:
258.sp
259#stop
260.sp
261This will cause all default commands to be ignored.
262The #stop line should be the last line in that section of the file.
263.PP
264Be aware that #stop can be dangerous.
265Since all default commands are disabled,
266you must provide sufficient commands before the #stop line
267to enable all necessary actions.
268For example, failure to provide a "quit" command can lead to frustration.
269
270.SH "LINE EDITING SECTION"
271The line-editing section begins with the line:
272.sp
273#line-edit
274.sp
275This section specifies new key bindings for the line editing commands,
276in a manner similar to the way key bindings for
277ordinary commands are specified in the #command section.
278The line-editing section consists of a list of keys and actions,
279one per line as in the example below.
280
281.SH EXAMPLE
282The following input file describes the set of
283default line-editing keys used by less:
284.sp
285.nf
286 #line-edit
287 \et forw-complete
288 \e17 back-complete
289 \ee\et back-complete
290 ^L expand
291 ^V literal
292 ^A literal
293 \eel right
294 \ekr right
295 \eeh left
296 \ekl left
297 \eeb word-left
298 \ee\ekl word-left
299 \eew word-right
300 \ee\ekr word-right
301 \eei insert
302 \eex delete
303 \ekx delete
304 \eeX word-delete
305 \eekx word-delete
306 \ee\eb word-backspace
307 \ee0 home
308 \ekh home
309 \ee$ end
310 \eke end
311 \eek up
312 \eku up
313 \eej down
314.fi
315.sp
316
317.SH "LESS ENVIRONMENT VARIABLES"
318The environment variable section begins with the line
319.sp
320#env
321.sp
322Following this line is a list of environment variable assignments.
323Each line consists of an environment variable name, an equals sign (=)
324and the value to be assigned to the environment variable.
325White space before and after the equals sign is ignored.
326Variables assigned in this way are visible only to
327.I less.
328If a variable is specified in the system environment and also in a
329lesskey file, the value in the lesskey file takes precedence.
330Although the lesskey file can be used to override variables set in the
331environment, the main purpose of assigning variables in the lesskey file
332is simply to have all
333.I less
334configuration information stored in one file.
335
336.SH EXAMPLE
337The following input file sets the -i option whenever
338.I less
339is run, and specifies the character set to be "latin1":
340.sp
341.nf
342 #env
343 LESS = -i
344 LESSCHARSET = latin1
345.fi
346.sp
347
348.SH "SEE ALSO"
349less(1)
350
351.SH WARNINGS
352It is not possible to specify special keys, such as uparrow,
353in a keyboard-independent manner.
354The only way to specify such keys is to specify the escape sequence
355which a particular keyboard sends when such a key is pressed.
356.PP
357On MS-DOS and OS/2 systems, certain keys send a sequence of characters
358which start with a NUL character (0).
359This NUL character should be represented as \e340 in a lesskey file.
360
361.SH COPYRIGHT
a9adbba3 362Copyright (C) 2000-2009 Mark Nudelman
131ccf9c
PA
363.PP
364lesskey is part of the GNU project and is free software;
365you can redistribute it and/or modify it
366under the terms of the GNU General Public License as published by
367the Free Software Foundation;
368either version 2, or (at your option) any later version.
369.PP
370lesskey is distributed in the hope that it will be useful, but
371WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
372or FITNESS FOR A PARTICULAR PURPOSE.
373See the GNU General Public License for more details.
374.PP
375You should have received a copy of the GNU General Public License
376along with lesskey; see the file COPYING.
377If not, write to the Free Software Foundation, 59 Temple Place,
378Suite 330, Boston, MA 02111-1307, USA.
379
380.SH AUTHOR
381.PP
382Mark Nudelman <markn@greenwoodsoftware.com>
383.br
384Send bug reports or comments to the above address or to bug-less@gnu.org.
385