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