1LESSKEY(1)                  General Commands Manual                 LESSKEY(1)
2
3
4

NAME

6       lesskey - specify key bindings for less
7

SYNOPSIS

9       lesskey [-o output] [--] [input]
10       lesskey [--output=output] [--] [input]
11       lesskey -V
12       lesskey --version
13

DESCRIPTION

15       Lesskey  is  used  to specify a set of key bindings to be used by less.
16       The input file is a text file which describes the key bindings.  If the
17       input  file is "-", standard input is read.  If no input file is speci‐
18       fied, a standard filename is used as the name of the input file,  which
19       depends  on the system being used: On Unix systems, "$HOME/.lesskey" is
20       used; on MS-DOS systems, "$HOME/_lesskey" is used; and on OS/2  systems
21       "$HOME/lesskey.ini"  is  used, or "$INIT/lesskey.ini" if $HOME is unde‐
22       fined.  The output file is a binary file which is used by less.  If  no
23       output  file is specified, and the environment variable LESSKEY is set,
24       the value of LESSKEY is used as the name of the  output  file.   Other‐
25       wise, a standard filename is used as the name of the output file, which
26       depends  on  the  system  being  used:  On  Unix  and   OS-9   systems,
27       "$HOME/.less" is used; on MS-DOS systems, "$HOME/_less" is used; and on
28       OS/2 systems, "$HOME/less.ini" is used, or "$INIT/less.ini" if $HOME is
29       undefined.   If  the output file already exists, lesskey will overwrite
30       it.
31
32       The -V or --version option causes lesskey to print its  version  number
33       and immediately exit.  If -V or --version is present, other options and
34       arguments are ignored.
35
36       The input file consists of one or more sections.  Each  section  starts
37       with  a  line  that  identifies the type of section.  Possible sections
38       are:
39
40       #command
41              Defines new command keys.
42
43       #line-edit
44              Defines new line-editing keys.
45
46       #env   Defines environment variables.
47
48       Blank lines and lines which start with a pound sign  (#)  are  ignored,
49       except for the special section header lines.
50

COMMAND SECTION

52       The command section begins with the line
53
54       #command
55
56       If  the command section is the first section in the file, this line may
57       be omitted.  The command section consists of lines of the form:
58
59            string <whitespace> action [extra-string] <newline>
60
61       Whitespace is any sequence of one or  more  spaces  and/or  tabs.   The
62       string  is  the command key(s) which invoke the action.  The string may
63       be a single command key, or a sequence of up to 15 keys.  The action is
64       the  name  of  the less action, from the list below.  The characters in
65       the string may appear literally, or be prefixed by a caret to  indicate
66       a  control  key.  A backslash followed by one to three octal digits may
67       be used to specify a character by its octal value.   A  backslash  fol‐
68       lowed by certain characters specifies input characters as follows:
69
70       \b     BACKSPACE
71
72       \e     ESCAPE
73
74       \n     NEWLINE
75
76       \r     RETURN
77
78       \t     TAB
79
80       \ku    UP ARROW
81
82       \kd    DOWN ARROW
83
84       \kr    RIGHT ARROW
85
86       \kl    LEFT ARROW
87
88       \kU    PAGE UP
89
90       \kD    PAGE DOWN
91
92       \kh    HOME
93
94       \ke    END
95
96       \kx    DELETE
97
98       A backslash followed by any other character indicates that character is
99       to be taken literally.  Characters which must be preceded by  backslash
100       include caret, space, tab and the backslash itself.
101
102       An action may be followed by an "extra" string.  When such a command is
103       entered while running less, the action is performed, and then the extra
104       string  is  parsed,  just as if it were typed in to less.  This feature
105       can be used in certain cases to extend the functionality of a  command.
106       For  example,  see the "{" and ":t" commands in the example below.  The
107       extra string has a special meaning for the  "quit"  action:  when  less
108       quits, the first character of the extra string is used as its exit sta‐
109       tus.
110

EXAMPLE

112       The following input file describes the set of default command keys used
113       by less:
114
115
116            #command
117            \r         forw-line
118            \n         forw-line
119            e          forw-line
120            j          forw-line
121            \kd        forw-line
122            ^E         forw-line
123            ^N         forw-line
124            k          back-line
125            y          back-line
126            ^Y         back-line
127            ^K         back-line
128            ^P         back-line
129            J          forw-line-force
130            K          back-line-force
131            Y          back-line-force
132
133            d          forw-scroll
134            ^D         forw-scroll
135            u          back-scroll
136            ^U         back-scroll
137            \40        forw-screen
138            f          forw-screen
139            ^F         forw-screen
140            ^V         forw-screen
141            \kD        forw-screen
142            b          back-screen
143            ^B         back-screen
144            \ev        back-screen
145            \kU        back-screen
146            z          forw-window
147            w          back-window
148            \e\40      forw-screen-force
149            F          forw-forever
150            \eF        forw-until-hilite
151            R          repaint-flush
152            r          repaint
153            ^R         repaint
154            ^L         repaint
155            \eu        undo-hilite
156            \eU        clear-search
157            g          goto-line
158            \kh        goto-line
159            <          goto-line
160            \e<        goto-line
161            p          percent
162            %          percent
163            \e[        left-scroll
164            \e]        right-scroll
165            \e(        left-scroll
166            \e)        right-scroll
167            \kl        left-scroll
168            \kr        right-scroll
169            \e{        no-scroll
170            \e}        end-scroll
171            {          forw-bracket {}
172            }          back-bracket {}
173            (          forw-bracket ()
174            )          back-bracket ()
175            [          forw-bracket []
176            ]          back-bracket []
177            \e^F       forw-bracket
178            \e^B       back-bracket
179            G          goto-end
180            \e>        goto-end
181            >          goto-end
182            \ke        goto-end
183            \eG        goto-end-buffered
184            =          status
185            ^G         status
186            :f         status
187            /          forw-search
188            ?          back-search
189            \e/        forw-search *
190            \e?        back-search *
191            n          repeat-search
192            \en        repeat-search-all
193            N          reverse-search
194            \eN        reverse-search-all
195            &          filter
196            m          set-mark
197            M          set-mark-bottom
198
199            \em        clear-mark
200            '          goto-mark
201            ^X^X       goto-mark
202            E          examine
203            :e         examine
204            ^X^V       examine
205            :n         next-file
206            :p         prev-file
207            t          next-tag
208            T          prev-tag
209            :x         index-file
210            :d         remove-file
211            -          toggle-option
212            :t         toggle-option t
213            s          toggle-option o
214            _          display-option
215            |          pipe
216            v          visual
217            !          shell
218            +          firstcmd
219            H          help
220            h          help
221            V          version
222            0          digit
223            1          digit
224            2          digit
225            3          digit
226            4          digit
227            5          digit
228            6          digit
229            7          digit
230            8          digit
231            9          digit
232            q          quit
233            Q          quit
234            :q         quit
235            :Q         quit
236            ZZ         quit
237
238

PRECEDENCE

240       Commands  specified  by  lesskey  take precedence over the default com‐
241       mands.  A default command key may be disabled by including  it  in  the
242       input  file with the action "invalid".  Alternatively, a key may be de‐
243       fined to do nothing by using the action "noaction".  "noaction" is sim‐
244       ilar  to  "invalid",  but less will give an error beep for an "invalid"
245       command, but not for a "noaction" command.  In  addition,  ALL  default
246       commands may be disabled by adding this control line to the input file:
247
248       #stop
249
250       This  will  cause  all  default commands to be ignored.  The #stop line
251       should be the last line in that section of the file.
252
253       Be aware that #stop can be dangerous.  Since all default  commands  are
254       disabled, you must provide sufficient commands before the #stop line to
255       enable all necessary actions.  For example, failure to provide a "quit"
256       command can lead to frustration.
257

LINE EDITING SECTION

259       The line-editing section begins with the line:
260
261       #line-edit
262
263       This  section specifies new key bindings for the line editing commands,
264       in a manner similar to the way key bindings for ordinary  commands  are
265       specified  in  the #command section.  The line-editing section consists
266       of a list of keys and actions, one per line as in the example below.
267

EXAMPLE

269       The following input file describes the set of default line-editing keys
270       used by less:
271
272
273            #line-edit
274            \t           forw-complete
275            \17          back-complete
276            \e\t         back-complete
277            ^L           expand
278            ^V           literal
279            ^A           literal
280            \el          right
281            \kr          right
282            \eh          left
283            \kl          left
284            \eb          word-left
285            \e\kl        word-left
286            \ew          word-right
287            \e\kr        word-right
288            \ei          insert
289            \ex          delete
290            \kx          delete
291            \eX          word-delete
292            \ekx         word-delete
293            \e\b         word-backspace
294            \e0          home
295            \kh          home
296            \e$          end
297            \ke          end
298            \ek          up
299            \ku          up
300            \ej          down
301            ^G           abort
302
303

LESS ENVIRONMENT VARIABLES

305       The environment variable section begins with the line
306
307       #env
308
309       Following  this  line  is  a  list of environment variable assignments.
310       Each line consists of an environment variable name, an equals sign  (=)
311       and  the value to be assigned to the environment variable.  White space
312       before and after the equals sign is  ignored.   Variables  assigned  in
313       this  way  are visible only to less.  If a variable is specified in the
314       system environment and also in a lesskey file, the value in the lesskey
315       file  takes precedence.  Although the lesskey file can be used to over‐
316       ride variables set in the environment, the main  purpose  of  assigning
317       variables  in the lesskey file is simply to have all less configuration
318       information stored in one file.
319

EXAMPLE

321       The following input file sets the -i option whenever less is  run,  and
322       specifies the character set to be "latin1":
323
324                 #env
325                 LESS = -i
326                 LESSCHARSET = latin1
327
328

SEE ALSO

330       less(1)
331

WARNINGS

333       On  MS-DOS and OS/2 systems, certain keys send a sequence of characters
334       which start with a NUL character (0).  This  NUL  character  should  be
335       represented as \340 in a lesskey file.
336
338       Copyright (C) 1984-2021  Mark Nudelman
339
340       less  is  part of the GNU project and is free software.  You can redis‐
341       tribute it and/or modify it under the terms of either (1) the GNU  Gen‐
342       eral  Public  License  as published by the Free Software Foundation; or
343       (2) the Less License.  See the file README in the less distribution for
344       more details regarding redistribution.  You should have received a copy
345       of the GNU General Public License along with the source for  less;  see
346       the  file  COPYING.   If not, write to the Free Software Foundation, 59
347       Temple Place, Suite 330, Boston, MA  02111-1307, USA.  You should  also
348       have received a copy of the Less License; see the file LICENSE.
349
350       less is distributed in the hope that it will be useful, but WITHOUT ANY
351       WARRANTY; without even the implied warranty of MERCHANTABILITY or  FIT‐
352       NESS  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
353       more details.
354

AUTHOR

356       Mark Nudelman
357       Report bugs at https://github.com/gwsw/less/issues.
358
359
360
361                          Version 581.2: 28 Apr 2021                LESSKEY(1)
Impressum