1LESSKEY(1) General Commands Manual LESSKEY(1)
2
3
4
6 lesskey - specify key bindings for less
7
9 lesskey [-o output] [--] [input]
10 lesskey [--output=output] [--] [input]
11 lesskey -V
12 lesskey --version
13
15 This document describes the format of the lesskey source file, which is
16 used by less version 582 and later. In previous versions of less, a
17 separate program called lesskey was used to compile the lesskey source
18 file into a format understood by less. This compilation step is no
19 longer required and the lesskey program is therefore deprecated al‐
20 though the file format remains supported by less itself.
21
23 The input file consists of one or more sections. Each section starts
24 with a line that identifies the type of section. Possible sections
25 are:
26
27 #command
28 Defines new command keys.
29
30 #line-edit
31 Defines new line-editing keys.
32
33 #env Defines environment variables.
34
35 Blank lines and lines which start with a pound sign (#) are ignored,
36 except for the special section header lines.
37
39 The command section begins with the line
40
41 #command
42
43 If the command section is the first section in the file, this line may
44 be omitted. The command section consists of lines of the form:
45
46 string <whitespace> action [extra-string] <newline>
47
48 Whitespace is any sequence of one or more spaces and/or tabs. The
49 string is the command key(s) which invoke the action. The string may
50 be a single command key, or a sequence of up to 15 keys. The action is
51 the name of the less action, from the list below. The characters in
52 the string may appear literally, or be prefixed by a caret to indicate
53 a control key. A backslash followed by one to three octal digits may
54 be used to specify a character by its octal value. A backslash fol‐
55 lowed by certain characters specifies input characters as follows:
56
57 \b BACKSPACE
58
59 \e ESCAPE
60
61 \n NEWLINE
62
63 \r RETURN
64
65 \t TAB
66
67 \ku UP ARROW
68
69 \kd DOWN ARROW
70
71 \kr RIGHT ARROW
72
73 \kl LEFT ARROW
74
75 \kU PAGE UP
76
77 \kD PAGE DOWN
78
79 \kh HOME
80
81 \ke END
82
83 \kx DELETE
84
85 A backslash followed by any other character indicates that character is
86 to be taken literally. Characters which must be preceded by backslash
87 include caret, space, tab and the backslash itself.
88
89 An action may be followed by an "extra" string. When such a command is
90 entered while running less, the action is performed, and then the extra
91 string is parsed, just as if it were typed in to less. This feature
92 can be used in certain cases to extend the functionality of a command.
93 For example, see the "{" and ":t" commands in the example below. The
94 extra string has a special meaning for the "quit" action: when less
95 quits, the first character of the extra string is used as its exit sta‐
96 tus.
97
99 The following input file describes the set of default command keys used
100 by less:
101
102
103 #command
104 \r forw-line
105 \n forw-line
106 e forw-line
107 j forw-line
108 \kd forw-line
109 ^E forw-line
110 ^N forw-line
111 k back-line
112 y back-line
113 ^Y back-line
114 ^K back-line
115 ^P back-line
116 J forw-line-force
117 K back-line-force
118 Y back-line-force
119 d forw-scroll
120 ^D forw-scroll
121 u back-scroll
122 ^U back-scroll
123 \40 forw-screen
124 f forw-screen
125 ^F forw-screen
126 ^V forw-screen
127 \kD forw-screen
128 b back-screen
129 ^B back-screen
130 \ev back-screen
131 \kU back-screen
132
133 z forw-window
134 w back-window
135 \e\40 forw-screen-force
136 F forw-forever
137 \eF forw-until-hilite
138 R repaint-flush
139 r repaint
140 ^R repaint
141 ^L repaint
142 \eu undo-hilite
143 \eU clear-search
144 g goto-line
145 \kh goto-line
146 < goto-line
147 \e< goto-line
148 p percent
149 % percent
150 \e[ left-scroll
151 \e] right-scroll
152 \e( left-scroll
153 \e) right-scroll
154 \kl left-scroll
155 \kr right-scroll
156 \e{ no-scroll
157 \e} end-scroll
158 { forw-bracket {}
159 } back-bracket {}
160 ( forw-bracket ()
161 ) back-bracket ()
162 [ forw-bracket []
163 ] back-bracket []
164 \e^F forw-bracket
165 \e^B back-bracket
166 G goto-end
167 \e> goto-end
168 > goto-end
169 \ke goto-end
170 \eG goto-end-buffered
171 = status
172 ^G status
173 :f status
174 / forw-search
175 ? back-search
176 \e/ forw-search *
177 \e? back-search *
178 n repeat-search
179 \en repeat-search-all
180 N reverse-search
181 \eN reverse-search-all
182 & filter
183 m set-mark
184 M set-mark-bottom
185 \em clear-mark
186 ' goto-mark
187 ^X^X goto-mark
188 E examine
189 :e examine
190 ^X^V examine
191 :n next-file
192 :p prev-file
193 t next-tag
194 T prev-tag
195 :x index-file
196 :d remove-file
197 - toggle-option
198
199 :t toggle-option t
200 s toggle-option o
201 _ display-option
202 | pipe
203 v visual
204 ! shell
205 + firstcmd
206 H help
207 h help
208 V version
209 0 digit
210 1 digit
211 2 digit
212 3 digit
213 4 digit
214 5 digit
215 6 digit
216 7 digit
217 8 digit
218 9 digit
219 q quit
220 Q quit
221 :q quit
222 :Q quit
223 ZZ quit
224
225
227 Commands specified by lesskey take precedence over the default com‐
228 mands. A default command key may be disabled by including it in the
229 input file with the action "invalid". Alternatively, a key may be de‐
230 fined to do nothing by using the action "noaction". "noaction" is sim‐
231 ilar to "invalid", but less will give an error beep for an "invalid"
232 command, but not for a "noaction" command. In addition, ALL default
233 commands may be disabled by adding this control line to the input file:
234
235 #stop
236
237 This will cause all default commands to be ignored. The #stop line
238 should be the last line in that section of the file.
239
240 Be aware that #stop can be dangerous. Since all default commands are
241 disabled, you must provide sufficient commands before the #stop line to
242 enable all necessary actions. For example, failure to provide a "quit"
243 command can lead to frustration.
244
246 The line-editing section begins with the line:
247
248 #line-edit
249
250 This section specifies new key bindings for the line editing commands,
251 in a manner similar to the way key bindings for ordinary commands are
252 specified in the #command section. The line-editing section consists
253 of a list of keys and actions, one per line as in the example below.
254
256 The following input file describes the set of default line-editing keys
257 used by less:
258
259
260 #line-edit
261 \t forw-complete
262 \17 back-complete
263 \e\t back-complete
264
265 ^L expand
266 ^V literal
267 ^A literal
268 \el right
269 \kr right
270 \eh left
271 \kl left
272 \eb word-left
273 \e\kl word-left
274 \ew word-right
275 \e\kr word-right
276 \ei insert
277 \ex delete
278 \kx delete
279 \eX word-delete
280 \ekx word-delete
281 \e\b word-backspace
282 \e0 home
283 \kh home
284 \e$ end
285 \ke end
286 \ek up
287 \ku up
288 \ej down
289 ^G abort
290
291
293 The environment variable section begins with the line
294
295 #env
296
297 Following this line is a list of environment variable assignments.
298 Each line consists of an environment variable name, an equals sign (=)
299 and the value to be assigned to the environment variable. White space
300 before and after the equals sign is ignored. Variables assigned in
301 this way are visible only to less. If a variable is specified in the
302 system environment and also in a lesskey file, the value in the lesskey
303 file takes precedence. Although the lesskey file can be used to over‐
304 ride variables set in the environment, the main purpose of assigning
305 variables in the lesskey file is simply to have all less configuration
306 information stored in one file.
307
309 The following input file sets the -i option whenever less is run, and
310 specifies the character set to be "latin1":
311
312 #env
313 LESS = -i
314 LESSCHARSET = latin1
315
316
318 less(1)
319
321 On MS-DOS and OS/2 systems, certain keys send a sequence of characters
322 which start with a NUL character (0). This NUL character should be
323 represented as \340 in a lesskey file.
324
326 Copyright (C) 1984-2021 Mark Nudelman
327
328 less is part of the GNU project and is free software. You can redis‐
329 tribute it and/or modify it under the terms of either (1) the GNU Gen‐
330 eral Public License as published by the Free Software Foundation; or
331 (2) the Less License. See the file README in the less distribution for
332 more details regarding redistribution. You should have received a copy
333 of the GNU General Public License along with the source for less; see
334 the file COPYING. If not, write to the Free Software Foundation, 59
335 Temple Place, Suite 330, Boston, MA 02111-1307, USA. You should also
336 have received a copy of the Less License; see the file LICENSE.
337
338 less is distributed in the hope that it will be useful, but WITHOUT ANY
339 WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT‐
340 NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
341 more details.
342
344 Mark Nudelman
345 Report bugs at https://github.com/gwsw/less/issues.
346
347
348
349 Version 590: 03 Jun 2021 LESSKEY(1)