]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/less/lesskey.nro
MFC r368207,368607:
[FreeBSD/stable/10.git] / contrib / less / lesskey.nro
1 .TH LESSKEY 1 "Version 530: 05 Dec 2017"
2 .SH NAME
3 lesskey \- 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
14 is used to specify a set of key bindings to be used by 
15 .I less.
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 
25 .I less.
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,
36 .I lesskey
37 will overwrite it.
38 .PP
39 The -V or --version option causes
40 .I lesskey
41 to print its version number and immediately exit.  
42 If -V or --version is present, other options and arguments are ignored.
43 .PP
44 The input file consists of one or more
45 .I sections.
46 Each section starts with a line that identifies the type of section.
47 Possible sections are:
48 .IP #command
49 Defines new command keys.
50 .IP #line-edit
51 Defines new line-editing keys.
52 .IP #env
53 Defines environment variables.
54 .PP
55 Blank lines and lines which start with a pound sign (#) are ignored,
56 except for the special section header lines.
57
58 .SH "COMMAND SECTION"
59 The command section begins with the line
60 .sp
61 #command
62 .sp
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:
66 .sp
67         \fIstring\fP <whitespace> \fIaction\fP [extra-string] <newline>
68 .sp
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:
79 .IP \eb
80 BACKSPACE
81 .IP \ee
82 ESCAPE
83 .IP \en
84 NEWLINE
85 .IP \er
86 RETURN
87 .IP \et
88 TAB
89 .IP \eku
90 UP ARROW
91 .IP \ekd
92 DOWN ARROW
93 .IP \ekr
94 RIGHT ARROW
95 .IP \ekl
96 LEFT ARROW
97 .IP \ekU
98 PAGE UP
99 .IP \ekD
100 PAGE DOWN
101 .IP \ekh
102 HOME
103 .IP \eke
104 END
105 .IP \ekx
106 DELETE
107 .PP
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.
112 .PP
113 An action may be followed by an "extra" string.
114 When such a command is entered while running
115 .I less,
116 the action is performed, and then the extra
117 string is parsed, just as if it were typed in to
118 .I less.
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:
123 when
124 .I less
125 quits, first character of the extra string is used as its exit status.
126
127 .SH EXAMPLE
128 The following input file describes the set of
129 default 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         \eeF            forw-until-hilite
166         R               repaint-flush 
167         r               repaint 
168         ^R              repaint 
169         ^L              repaint 
170         \eeu            undo-hilite
171         g               goto-line 
172         \ekh            goto-line
173         <               goto-line 
174         \ee<            goto-line 
175         p               percent 
176         %               percent 
177         \ee[            left-scroll
178         \ee]            right-scroll
179         \ee(            left-scroll
180         \ee)            right-scroll
181         \ekl            left-scroll
182         \ekr            right-scroll
183         \ee{            no-scroll
184         \ee}            end-scroll
185         {               forw-bracket {}
186         }               back-bracket {}
187         (               forw-bracket ()
188         )               back-bracket ()
189         [               forw-bracket []
190         ]               back-bracket []
191         \ee^F           forw-bracket 
192         \ee^B           back-bracket 
193         G               goto-end 
194         \ee>            goto-end 
195         >               goto-end 
196         \eke            goto-end
197         \eeG            goto-end-buffered
198         =               status 
199         ^G              status 
200         :f              status 
201         /               forw-search 
202         ?               back-search 
203         \ee/            forw-search *
204         \ee?            back-search *
205         n               repeat-search 
206         \een            repeat-search-all 
207         N               reverse-search 
208         \eeN            reverse-search-all 
209         &               filter
210         m               set-mark 
211         M               set-mark-bottom
212         \eem            clear-mark
213         '               goto-mark 
214         ^X^X            goto-mark 
215         E               examine 
216         :e              examine 
217         ^X^V            examine 
218         :n              next-file 
219         :p              prev-file 
220         t               next-tag
221         T               prev-tag
222         :x              index-file 
223         :d              remove-file
224         -               toggle-option 
225         :t              toggle-option t
226         s               toggle-option o
227         _               display-option 
228         |               pipe 
229         v               visual 
230         !               shell 
231         +               firstcmd 
232         H               help 
233         h               help 
234         V               version 
235         0               digit
236         1               digit
237         2               digit
238         3               digit
239         4               digit
240         5               digit
241         6               digit
242         7               digit
243         8               digit
244         9               digit
245         q               quit 
246         Q               quit 
247         :q              quit 
248         :Q              quit 
249         ZZ              quit 
250 .fi
251 .sp
252 .SH PRECEDENCE
253 Commands specified by
254 .I lesskey
255 take precedence over the default commands.
256 A default command key may be disabled by including it in the
257 input file with the action "invalid".
258 Alternatively, a key may be defined 
259 to do nothing by using the action "noaction".
260 "noaction" is similar to "invalid", but 
261 .I less
262 will give an error beep for an "invalid" command, 
263 but not for a "noaction" command.
264 In addition, ALL default commands may be disabled by 
265 adding this control line to the input file:
266 .sp
267 #stop
268 .sp
269 This will cause all default commands to be ignored.
270 The #stop line should be the last line in that section of the file.
271 .PP
272 Be aware that #stop can be dangerous.  
273 Since all default commands are disabled, 
274 you must provide sufficient commands before the #stop line
275 to enable all necessary actions.
276 For example, failure to provide a "quit" command can lead to frustration.
277
278 .SH "LINE EDITING SECTION"
279 The line-editing section begins with the line:
280 .sp
281 #line-edit
282 .sp
283 This section specifies new key bindings for the line editing commands,
284 in a manner similar to the way key bindings for 
285 ordinary commands are specified in the #command section.
286 The line-editing section consists of a list of keys and actions,
287 one per line as in the example below.
288
289 .SH EXAMPLE
290 The following input file describes the set of
291 default line-editing keys used by less:
292 .sp
293 .nf
294         #line-edit
295         \et             forw-complete
296         \e17            back-complete
297         \ee\et          back-complete
298         ^L              expand
299         ^V              literal
300         ^A              literal
301         \eel            right
302         \ekr            right
303         \eeh            left
304         \ekl            left
305         \eeb            word-left
306         \ee\ekl word-left
307         \eew            word-right
308         \ee\ekr word-right
309         \eei            insert
310         \eex            delete
311         \ekx            delete
312         \eeX            word-delete
313         \eekx           word-delete
314         \ee\eb          word-backspace
315         \ee0            home
316         \ekh            home
317         \ee$            end
318         \eke            end
319         \eek            up
320         \eku            up
321         \eej            down
322         ^G              abort
323 .fi
324 .sp
325
326 .SH "LESS ENVIRONMENT VARIABLES"
327 The environment variable section begins with the line
328 .sp
329 #env
330 .sp
331 Following this line is a list of environment variable assignments.
332 Each line consists of an environment variable name, an equals sign (=)
333 and the value to be assigned to the environment variable.
334 White space before and after the equals sign is ignored.
335 Variables assigned in this way are visible only to
336 .I less.
337 If a variable is specified in the system environment and also in a
338 lesskey file, the value in the lesskey file takes precedence.
339 Although the lesskey file can be used to override variables set in the
340 environment, the main purpose of assigning variables in the lesskey file
341 is simply to have all 
342 .I less
343 configuration information stored in one file.
344
345 .SH EXAMPLE
346 The following input file sets the -i option whenever 
347 .I less
348 is run, and specifies the character set to be "latin1":
349 .sp
350 .nf
351         #env
352         LESS = -i
353         LESSCHARSET = latin1
354 .fi
355 .sp
356
357 .SH "SEE ALSO"
358 less(1)
359
360 .SH WARNINGS
361 On MS-DOS and OS/2 systems, certain keys send a sequence of characters
362 which start with a NUL character (0).
363 This NUL character should be represented as \e340 in a lesskey file.
364
365 .SH COPYRIGHT
366 Copyright (C) 1984-2017  Mark Nudelman
367 .PP
368 less is part of the GNU project and is free software.
369 You can redistribute it and/or modify it
370 under the terms of either
371 (1) the GNU General Public License as published by
372 the Free Software Foundation; or (2) the Less License.
373 See the file README in the less distribution for more details
374 regarding redistribution.
375 You should have received a copy of the GNU General Public License
376 along with the source for less; see the file COPYING.
377 If not, write to the Free Software Foundation, 59 Temple Place,
378 Suite 330, Boston, MA  02111-1307, USA.
379 You should also have received a copy of the Less License;
380 see the file LICENSE.
381 .PP
382 less is distributed in the hope that it will be useful, but
383 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
384 or FITNESS FOR A PARTICULAR PURPOSE.
385 See the GNU General Public License for more details.
386
387 .SH AUTHOR
388 .PP
389 Mark Nudelman
390 .br
391 Send bug reports or comments to <bug-less@gnu.org>.