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 undefined.
22       The output file is a binary file which is used by less.  If  no  output
23       file  is  specified,  and  the environment variable LESSKEY is set, the
24       value of LESSKEY is used as the name of the output file.  Otherwise,  a
25       standard filename is used as the name of the output file, which depends
26       on the system being used: On Unix  and  OS-9  systems,  $HOME/.less  is
27       used;  on  MS-DOS  systems,  $HOME/_less  is used; and on OS/2 systems,
28       $HOME/less.ini is used, or $INIT/less.ini if $HOME  is  undefined.   If
29       the output file already exists, lesskey will overwrite it.
30
31       The  -V  or --version option causes lesskey to print its version number
32       and immediately exit.  If -V or --version is present, other options and
33       arguments are ignored.
34
35       The  input  file consists of one or more sections.  Each section starts
36       with a line that identifies the type  of  section.   Possible  sections
37       are:
38
39       #command
40              Defines new command keys.
41
42       #line-edit
43              Defines new line-editing keys.
44
45       #env   Defines environment variables.
46
47       Blank  lines  and  lines which start with a pound sign (#) are ignored,
48       except for the special section header lines.
49
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, first character of the extra string is used as its exit status.
109
110

EXAMPLE

112       The following input file describes the set of default command keys used
113       by less:
114
115            #command
116            \r        forw-line
117            \n        forw-line
118            e         forw-line
119            j         forw-line
120            \kd  forw-line
121            ^E        forw-line
122            ^N        forw-line
123            k         back-line
124            y         back-line
125            ^Y        back-line
126            ^K        back-line
127            ^P        back-line
128            J         forw-line-force
129            K         back-line-force
130            Y         back-line-force
131            d         forw-scroll
132            ^D        forw-scroll
133            u         back-scroll
134            ^U        back-scroll
135            \40  forw-screen
136            f         forw-screen
137            ^F        forw-screen
138            ^V        forw-screen
139            \kD  forw-screen
140            b         back-screen
141            ^B        back-screen
142            \ev       back-screen
143            \kU  back-screen
144            z         forw-window
145            w         back-window
146            \e\40          forw-screen-force
147            F         forw-forever
148            R         repaint-flush
149            r         repaint
150            ^R        repaint
151            ^L        repaint
152            \eu       undo-hilite
153            g         goto-line
154            \kh  goto-line
155            <         goto-line
156            \e<       goto-line
157            p         percent
158            %         percent
159            \e[       left-scroll
160            \e]       right-scroll
161            \e(       left-scroll
162            \e)       right-scroll
163            {         forw-bracket {}
164            }         back-bracket {}
165            (         forw-bracket ()
166            )         back-bracket ()
167            [         forw-bracket []
168            ]         back-bracket []
169            \e^F      forw-bracket
170            \e^B      back-bracket
171            G         goto-end
172            \e>       goto-end
173            >         goto-end
174            \ke  goto-end
175            =         status
176            ^G        status
177            :f        status
178            /         forw-search
179            ?         back-search
180            \e/       forw-search *
181            \e?       back-search *
182            n         repeat-search
183            \en       repeat-search-all
184            N         reverse-search
185            \eN       reverse-search-all
186            m         set-mark
187            '         goto-mark
188            ^X^X      goto-mark
189            E         examine
190            :e        examine
191            ^X^V      examine
192            :n        next-file
193            :p        prev-file
194            t         next-tag
195            T         prev-tag
196            :x        index-file
197            :d        remove-file
198            -         toggle-option
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

PRECEDENCE

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
230       defined to do nothing by using the action  "noaction".   "noaction"  is
231       similar 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
245

LINE EDITING SECTION

247       The line-editing section begins with the line:
248
249       #line-edit
250
251       This  section specifies new key bindings for the line editing commands,
252       in a manner similar to the way key bindings for ordinary  commands  are
253       specified  in  the #command section.  The line-editing section consists
254       of a list of keys and actions, one per line as in the example below.
255
256

EXAMPLE

258       The following input file describes the set of default line-editing keys
259       used by less:
260
261            #line-edit
262            \t        forw-complete
263            \17       back-complete
264            \e\t      back-complete
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
290
291

LESS ENVIRONMENT VARIABLES

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
308

EXAMPLE

310       The following input file sets the -i option whenever less is  run,  and
311       specifies the character set to be "latin1":
312
313            #env
314            LESS = -i
315            LESSCHARSET = latin1
316
317
318

SEE ALSO

320       less(1)
321
322

WARNINGS

324       It  is not possible to specify special keys, such as uparrow, in a key‐
325       board-independent manner.  The only way to  specify  such  keys  is  to
326       specify the escape sequence which a particular keyboard sends when such
327       a key is pressed.
328
329       On MS-DOS and OS/2 systems, certain keys send a sequence of  characters
330       which  start  with  a  NUL character (0).  This NUL character should be
331       represented as \340 in a lesskey file.
332
333
335       Copyright (C) 2004  Mark Nudelman
336
337       lesskey is part of the GNU project and is free software; you can redis‐
338       tribute  it  and/or modify it under the terms of the GNU General Public
339       License as published by the Free Software Foundation; either version 2,
340       or (at your option) any later version.
341
342       lesskey  is distributed in the hope that it will be useful, but WITHOUT
343       ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY  or
344       FITNESS  FOR  A PARTICULAR PURPOSE.  See the GNU General Public License
345       for more details.
346
347       You should have received a copy of the GNU General Public License along
348       with lesskey; see the file COPYING.  If not, write to the Free Software
349       Foundation, 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
350
351

AUTHOR

353       Mark Nudelman <markn@greenwoodsoftware.com>
354       Send  bug  reports  or  comments  to  the  above  address  or  to  bug-
355       less@gnu.org.
356
357
358
359
360                           Version 394: 03 Dec 2005                 LESSKEY(1)
Impressum