lesskey.man revision 225736
155682SmarkmLESSKEY(1)                                                          LESSKEY(1)
2178825Sdfr
355682Smarkm
455682Smarkm
555682Smarkm[1mNAME[0m
655682Smarkm       lesskey - specify key bindings for less
755682Smarkm
855682Smarkm[1mSYNOPSIS[0m
955682Smarkm       [1mlesskey [-o output] [--] [input][0m
1055682Smarkm       [1mlesskey [--output=output] [--] [input][0m
1155682Smarkm       [1mlesskey -V[0m
1255682Smarkm       [1mlesskey --version[0m
1355682Smarkm
1455682Smarkm[1mDESCRIPTION[0m
1555682Smarkm       [4mLesskey[24m  is  used  to specify a set of key bindings to be used by [4mless.[0m
1655682Smarkm       The input file is a text file which describes the key bindings.  If the
1755682Smarkm       input  file is "-", standard input is read.  If no input file is speci-
1855682Smarkm       fied, a standard filename is used as the name of the input file,  which
1955682Smarkm       depends  on  the  system being used: On Unix systems, $HOME/.lesskey is
2055682Smarkm       used; on MS-DOS systems, $HOME/_lesskey is used; and  on  OS/2  systems
2155682Smarkm       $HOME/lesskey.ini  is used, or $INIT/lesskey.ini if $HOME is undefined.
2255682Smarkm       The output file is a binary file which is used by [4mless.[24m  If  no  output
2355682Smarkm       file  is  specified,  and  the environment variable LESSKEY is set, the
2455682Smarkm       value of LESSKEY is used as the name of the output file.  Otherwise,  a
2555682Smarkm       standard filename is used as the name of the output file, which depends
2655682Smarkm       on the system being used: On Unix  and  OS-9  systems,  $HOME/.less  is
2755682Smarkm       used;  on  MS-DOS  systems,  $HOME/_less  is used; and on OS/2 systems,
2855682Smarkm       $HOME/less.ini is used, or $INIT/less.ini if $HOME  is  undefined.   If
2955682Smarkm       the output file already exists, [4mlesskey[24m will overwrite it.
3055682Smarkm
3155682Smarkm       The  -V  or --version option causes [4mlesskey[24m to print its version number
3255682Smarkm       and immediately exit.  If -V or --version is present, other options and
3355682Smarkm       arguments are ignored.
3455682Smarkm
3555682Smarkm       The  input  file consists of one or more [4msections.[24m  Each section starts
3655682Smarkm       with a line that identifies the type  of  section.   Possible  sections
3755682Smarkm       are:
38178825Sdfr
3955682Smarkm       #command
4055682Smarkm              Defines new command keys.
4155682Smarkm
4255682Smarkm       #line-edit
4355682Smarkm              Defines new line-editing keys.
4455682Smarkm
4555682Smarkm       #env   Defines environment variables.
4655682Smarkm
4755682Smarkm       Blank  lines  and  lines which start with a pound sign (#) are ignored,
4855682Smarkm       except for the special section header lines.
4955682Smarkm
5055682Smarkm
5155682Smarkm[1mCOMMAND SECTION[0m
5255682Smarkm       The command section begins with the line
5355682Smarkm
5455682Smarkm       #command
5555682Smarkm
5655682Smarkm       If the command section is the first section in the file, this line  may
5755682Smarkm       be omitted.  The command section consists of lines of the form:
5855682Smarkm
5955682Smarkm            [4mstring[24m <whitespace> [4maction[24m [extra-string] <newline>
6055682Smarkm
6155682Smarkm       Whitespace  is  any  sequence  of  one or more spaces and/or tabs.  The
6255682Smarkm       [4mstring[24m is the command key(s) which invoke the action.  The  [4mstring[24m  may
6355682Smarkm       be a single command key, or a sequence of up to 15 keys.  The [4maction[24m is
6455682Smarkm       the name of the less action, from the list below.   The  characters  in
65102644Snectar       the  [4mstring[24m may appear literally, or be prefixed by a caret to indicate
6655682Smarkm       a control key.  A backslash followed by one to three octal  digits  may
67178825Sdfr       be  used  to  specify a character by its octal value.  A backslash fol-
68178825Sdfr       lowed by certain characters specifies input characters as follows:
69178825Sdfr
70178825Sdfr       \b     BACKSPACE
71102644Snectar
72102644Snectar       \e     ESCAPE
73102644Snectar
74178825Sdfr       \n     NEWLINE
75178825Sdfr
76178825Sdfr       \r     RETURN
77102644Snectar
78102644Snectar       \t     TAB
79102644Snectar
80178825Sdfr       \ku    UP ARROW
81178825Sdfr
82178825Sdfr       \kd    DOWN ARROW
83102644Snectar
84102644Snectar       \kr    RIGHT ARROW
85102644Snectar
86102644Snectar       \kl    LEFT ARROW
87102644Snectar
88102644Snectar       \kU    PAGE UP
89102644Snectar
90102644Snectar       \kD    PAGE DOWN
91102644Snectar
92102644Snectar       \kh    HOME
93102644Snectar
94102644Snectar       \ke    END
95102644Snectar
9655682Smarkm       \kx    DELETE
9755682Smarkm
9855682Smarkm       A backslash followed by any other character indicates that character is
9955682Smarkm       to  be taken literally.  Characters which must be preceded by backslash
10055682Smarkm       include caret, space, tab and the backslash itself.
10155682Smarkm
10255682Smarkm       An action may be followed by an "extra" string.  When such a command is
103178825Sdfr       entered while running [4mless,[24m the action is performed, and then the extra
104178825Sdfr       string is parsed, just as if it were typed in to  [4mless.[24m   This  feature
105178825Sdfr       can  be used in certain cases to extend the functionality of a command.
10655682Smarkm       For example, see the "{" and ":t" commands in the example  below.   The
107178825Sdfr       extra  string  has  a  special meaning for the "quit" action: when [4mless[0m
108178825Sdfr       quits, first character of the extra string is used as its exit status.
109178825Sdfr
110178825Sdfr
11155682Smarkm[1mEXAMPLE[0m
112178825Sdfr       The following input file describes the set of default command keys used
113178825Sdfr       by less:
114178825Sdfr
115178825Sdfr            #command
116178825Sdfr            \r        forw-line
117178825Sdfr            \n        forw-line
118178825Sdfr            e         forw-line
119178825Sdfr            j         forw-line
120178825Sdfr            \kd  forw-line
121102644Snectar            ^E        forw-line
122178825Sdfr            ^N        forw-line
123178825Sdfr            k         back-line
124102644Snectar            y         back-line
12555682Smarkm            ^Y        back-line
126178825Sdfr            ^K        back-line
127178825Sdfr            ^P        back-line
128178825Sdfr            J         forw-line-force
129178825Sdfr            K         back-line-force
130178825Sdfr            Y         back-line-force
131178825Sdfr            d         forw-scroll
13255682Smarkm            ^D        forw-scroll
133178825Sdfr            u         back-scroll
134178825Sdfr            ^U        back-scroll
135178825Sdfr            \40  forw-screen
136178825Sdfr            f         forw-screen
137178825Sdfr            ^F        forw-screen
138178825Sdfr            ^V        forw-screen
139178825Sdfr            \kD  forw-screen
140178825Sdfr            b         back-screen
141178825Sdfr            ^B        back-screen
142178825Sdfr            \ev       back-screen
143178825Sdfr            \kU  back-screen
144178825Sdfr            z         forw-window
145178825Sdfr            w         back-window
146178825Sdfr            \e\40          forw-screen-force
147178825Sdfr            F         forw-forever
148178825Sdfr            R         repaint-flush
149178825Sdfr            r         repaint
150178825Sdfr            ^R        repaint
151178825Sdfr            ^L        repaint
152178825Sdfr            \eu       undo-hilite
153178825Sdfr            g         goto-line
154178825Sdfr            \kh  goto-line
155178825Sdfr            <         goto-line
156178825Sdfr            \e<       goto-line
157178825Sdfr            p         percent
158178825Sdfr            %         percent
159178825Sdfr            \e[       left-scroll
160178825Sdfr            \e]       right-scroll
161178825Sdfr            \e(       left-scroll
162178825Sdfr            \e)       right-scroll
163178825Sdfr            {         forw-bracket {}
164178825Sdfr            }         back-bracket {}
165178825Sdfr            (         forw-bracket ()
166178825Sdfr            )         back-bracket ()
167178825Sdfr            [         forw-bracket []
168178825Sdfr            ]         back-bracket []
169178825Sdfr            \e^F      forw-bracket
170178825Sdfr            \e^B      back-bracket
171178825Sdfr            G         goto-end
172178825Sdfr            \e>       goto-end
173178825Sdfr            >         goto-end
174178825Sdfr            \ke  goto-end
175178825Sdfr            =         status
176178825Sdfr            ^G        status
17755682Smarkm            :f        status
17855682Smarkm            /         forw-search
179178825Sdfr            ?         back-search
180178825Sdfr            \e/       forw-search *
181178825Sdfr            \e?       back-search *
182178825Sdfr            n         repeat-search
183178825Sdfr            \en       repeat-search-all
184178825Sdfr            N         reverse-search
185178825Sdfr            \eN       reverse-search-all
18655682Smarkm            &         filter
187178825Sdfr            m         set-mark
188178825Sdfr            '         goto-mark
189178825Sdfr            ^X^X      goto-mark
190178825Sdfr            E         examine
191178825Sdfr            :e        examine
192178825Sdfr            ^X^V      examine
19355682Smarkm            :n        next-file
194178825Sdfr            :p        prev-file
195178825Sdfr            t         next-tag
196178825Sdfr            T         prev-tag
197178825Sdfr            :x        index-file
198178825Sdfr            :d        remove-file
199178825Sdfr            -         toggle-option
200178825Sdfr            :t        toggle-option t
201178825Sdfr            s         toggle-option o
20255682Smarkm            _         display-option
203178825Sdfr            |         pipe
204178825Sdfr            v         visual
20555682Smarkm            !         shell
206178825Sdfr            +         firstcmd
207178825Sdfr            H         help
208178825Sdfr            h         help
209178825Sdfr            V         version
210178825Sdfr            0         digit
21155682Smarkm            1         digit
212178825Sdfr            2         digit
213178825Sdfr            3         digit
21455682Smarkm            4         digit
215178825Sdfr            5         digit
216178825Sdfr            6         digit
21755682Smarkm            7         digit
218178825Sdfr            8         digit
21955682Smarkm            9         digit
220178825Sdfr            q         quit
221178825Sdfr            Q         quit
22255682Smarkm            :q        quit
223178825Sdfr            :Q        quit
224178825Sdfr            ZZ        quit
225178825Sdfr
226178825Sdfr
227178825Sdfr[1mPRECEDENCE[0m
22855682Smarkm       Commands  specified  by  [4mlesskey[24m  take precedence over the default com-
229178825Sdfr       mands.  A default command key may be disabled by including  it  in  the
230178825Sdfr       input  file  with  the  action  "invalid".  Alternatively, a key may be
231178825Sdfr       defined to do nothing by using the action  "noaction".   "noaction"  is
232178825Sdfr       similar to "invalid", but [4mless[24m will give an error beep for an "invalid"
233178825Sdfr       command, but not for a "noaction" command.  In  addition,  ALL  default
234178825Sdfr       commands may be disabled by adding this control line to the input file:
235178825Sdfr
236178825Sdfr       #stop
237178825Sdfr
238178825Sdfr       This  will  cause  all  default commands to be ignored.  The #stop line
23955682Smarkm       should be the last line in that section of the file.
240
241       Be aware that #stop can be dangerous.  Since all default  commands  are
242       disabled, you must provide sufficient commands before the #stop line to
243       enable all necessary actions.  For example, failure to provide a "quit"
244       command can lead to frustration.
245
246
247[1mLINE EDITING SECTION[0m
248       The line-editing section begins with the line:
249
250       #line-edit
251
252       This  section specifies new key bindings for the line editing commands,
253       in a manner similar to the way key bindings for ordinary  commands  are
254       specified  in  the #command section.  The line-editing section consists
255       of a list of keys and actions, one per line as in the example below.
256
257
258[1mEXAMPLE[0m
259       The following input file describes the set of default line-editing keys
260       used by less:
261
262            #line-edit
263            \t        forw-complete
264            \17       back-complete
265            \e\t      back-complete
266            ^L        expand
267            ^V        literal
268            ^A        literal
269            \el       right
270            \kr       right
271            \eh       left
272            \kl       left
273            \eb       word-left
274            \e\kl     word-left
275            \ew       word-right
276            \e\kr     word-right
277            \ei       insert
278            \ex       delete
279            \kx       delete
280            \eX       word-delete
281            \ekx      word-delete
282            \e\b      word-backspace
283            \e0       home
284            \kh       home
285            \e$       end
286            \ke       end
287            \ek       up
288            \ku       up
289            \ej       down
290            ^G        abort
291
292
293
294[1mLESS ENVIRONMENT VARIABLES[0m
295       The environment variable section begins with the line
296
297       #env
298
299       Following  this  line  is  a  list of environment variable assignments.
300       Each line consists of an environment variable name, an equals sign  (=)
301       and  the value to be assigned to the environment variable.  White space
302       before and after the equals sign is  ignored.   Variables  assigned  in
303       this  way  are visible only to [4mless.[24m  If a variable is specified in the
304       system environment and also in a lesskey file, the value in the lesskey
305       file  takes precedence.  Although the lesskey file can be used to over-
306       ride variables set in the environment, the main  purpose  of  assigning
307       variables  in the lesskey file is simply to have all [4mless[24m configuration
308       information stored in one file.
309
310
311[1mEXAMPLE[0m
312       The following input file sets the -i option whenever [4mless[24m is  run,  and
313       specifies the character set to be "latin1":
314
315            #env
316            LESS = -i
317            LESSCHARSET = latin1
318
319
320
321[1mSEE ALSO[0m
322       less(1)
323
324
325[1mWARNINGS[0m
326       On  MS-DOS and OS/2 systems, certain keys send a sequence of characters
327       which start with a NUL character (0).  This  NUL  character  should  be
328       represented as \340 in a lesskey file.
329
330
331[1mCOPYRIGHT[0m
332       Copyright (C) 2000-2011  Mark Nudelman
333
334       lesskey is part of the GNU project and is free software; you can redis-
335       tribute it and/or modify it under the terms of the GNU  General  Public
336       License as published by the Free Software Foundation; either version 2,
337       or (at your option) any later version.
338
339       lesskey is distributed in the hope that it will be useful, but  WITHOUT
340       ANY  WARRANTY;  without even the implied warranty of MERCHANTABILITY or
341       FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General  Public  License
342       for more details.
343
344       You should have received a copy of the GNU General Public License along
345       with lesskey; see the file COPYING.  If not, write to the Free Software
346       Foundation, 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
347
348
349[1mAUTHOR[0m
350       Mark Nudelman <markn@greenwoodsoftware.com>
351       Send  bug  reports  or  comments  to  the  above  address  or  to  bug-
352       less@gnu.org.
353
354
355
356
357                           Version 444: 09 Jun 2011                 LESSKEY(1)
358