lesskey.man revision 173682
198943SluigiLESSKEY(1)                                                          LESSKEY(1)
2117328Sluigi
398943Sluigi
498943Sluigi
598943Sluigi[1mNAME[0m
698943Sluigi       lesskey - specify key bindings for less
798943Sluigi
898943Sluigi[1mSYNOPSIS[0m
998943Sluigi       [1mlesskey [-o output] [--] [input][0m
1098943Sluigi       [1mlesskey [--output=output] [--] [input][0m
1198943Sluigi       [1mlesskey -V[0m
1298943Sluigi       [1mlesskey --version[0m
1398943Sluigi
1498943Sluigi[1mDESCRIPTION[0m
1598943Sluigi       [4mLesskey[24m  is  used  to specify a set of key bindings to be used by [4mless.[0m
1698943Sluigi       The input file is a text file which describes the key bindings, If  the
1798943Sluigi       input  file is "-", standard input is read.  If no input file is speci-
1898943Sluigi       fied, a standard filename is used as the name of the input file,  which
1998943Sluigi       depends  on  the  system being used: On Unix systems, $HOME/.lesskey is
2098943Sluigi       used; on MS-DOS systems, $HOME/_lesskey is used; and  on  OS/2  systems
2198943Sluigi       $HOME/lesskey.ini  is used, or $INIT/lesskey.ini if $HOME is undefined.
2298943Sluigi       The output file is a binary file which is used by [4mless.[24m  If  no  output
23187604Sluigi       file  is  specified,  and  the environment variable LESSKEY is set, the
24223262Sbenl       value of LESSKEY is used as the name of the output file.  Otherwise,  a
2598943Sluigi       standard filename is used as the name of the output file, which depends
2698943Sluigi       on the system being used: On Unix  and  OS-9  systems,  $HOME/.less  is
2798943Sluigi       used;  on  MS-DOS  systems,  $HOME/_less  is used; and on OS/2 systems,
2898943Sluigi       $HOME/less.ini is used, or $INIT/less.ini if $HOME  is  undefined.   If
29187767Sluigi       the output file already exists, [4mlesskey[24m will overwrite it.
30187767Sluigi
3198943Sluigi       The  -V  or --version option causes [4mlesskey[24m to print its version number
3298943Sluigi       and immediately exit.  If -V or --version is present, other options and
3398943Sluigi       arguments are ignored.
3498943Sluigi
3598943Sluigi       The  input  file consists of one or more [4msections.[24m  Each section starts
3698943Sluigi       with a line that identifies the type  of  section.   Possible  sections
3798943Sluigi       are:
3898943Sluigi
3998943Sluigi       #command
4098943Sluigi              Defines new command keys.
41187983Sluigi
42187604Sluigi       #line-edit
43136071Sgreen              Defines new line-editing keys.
44136071Sgreen
45234597Smelifaro       #env   Defines environment variables.
4698943Sluigi
47169424Smaxim       Blank  lines  and  lines which start with a pound sign (#) are ignored,
48187983Sluigi       except for the special section header lines.
4998943Sluigi
50187983Sluigi
5198943Sluigi[1mCOMMAND SECTION[0m
5298943Sluigi       The command section begins with the line
5398943Sluigi
5498943Sluigi       #command
5598943Sluigi
5698943Sluigi       If the command section is the first section in the file, this line  may
57187767Sluigi       be omitted.  The command section consists of lines of the form:
5898943Sluigi
59187767Sluigi            [4mstring[24m <whitespace> [4maction[24m [extra-string] <newline>
60187764Sluigi
61234597Smelifaro       Whitespace  is  any  sequence  of  one or more spaces and/or tabs.  The
62234597Smelifaro       [4mstring[24m is the command key(s) which invoke the action.  The  [4mstring[24m  may
63234597Smelifaro       be a single command key, or a sequence of up to 15 keys.  The [4maction[24m is
64234597Smelifaro       the name of the less action, from the list below.   The  characters  in
65234597Smelifaro       the  [4mstring[24m may appear literally, or be prefixed by a caret to indicate
66234597Smelifaro       a control key.  A backslash followed by one to three octal  digits  may
67248505Smelifaro       be  used  to  specify a character by its octal value.  A backslash fol-
68248505Smelifaro       lowed by certain characters specifies input characters as follows:
69248505Smelifaro
70248505Smelifaro       \b     BACKSPACE
71248505Smelifaro
72248505Smelifaro       \e     ESCAPE
73248505Smelifaro
74248505Smelifaro       \n     NEWLINE
75248505Smelifaro
76248505Smelifaro       \r     RETURN
77248505Smelifaro
78248505Smelifaro       \t     TAB
79248505Smelifaro
80248505Smelifaro       \ku    UP ARROW
81248505Smelifaro
82248505Smelifaro       \kd    DOWN ARROW
83159636Soleg
84204591Sluigi       \kr    RIGHT ARROW
85159636Soleg
86159636Soleg       \kl    LEFT ARROW
87159636Soleg
88159636Soleg       \kU    PAGE UP
89159636Soleg
90159636Soleg       \kD    PAGE DOWN
91159636Soleg
92204591Sluigi       \kh    HOME
93159636Soleg
94159636Soleg       \ke    END
95204591Sluigi
96159636Soleg       \kx    DELETE
97204591Sluigi
98159636Soleg       A backslash followed by any other character indicates that character is
99159636Soleg       to  be taken literally.  Characters which must be preceded by backslash
100159636Soleg       include caret, space, tab and the backslash itself.
101204591Sluigi
102159636Soleg       An action may be followed by an "extra" string.  When such a command is
103159636Soleg       entered while running [4mless,[24m the action is performed, and then the extra
104159636Soleg       string is parsed, just as if it were typed in to  [4mless.[24m   This  feature
105204591Sluigi       can  be used in certain cases to extend the functionality of a command.
106159636Soleg       For example, see the "{" and ":t" commands in the example  below.   The
107159636Soleg       extra  string  has  a  special meaning for the "quit" action: when [4mless[0m
108204591Sluigi       quits, first character of the extra string is used as its exit  status.
109159636Soleg
110158879Soleg
111158879Soleg[1mEXAMPLE[0m
112187762Sluigi       The following input file describes the set of default command keys used
113187762Sluigi       by less:
114187762Sluigi
115187762Sluigi            #command
116187762Sluigi            \r        forw-line
117187762Sluigi            \n        forw-line
118187762Sluigi            e         forw-line
119187762Sluigi            j         forw-line
120187762Sluigi            \kd  forw-line
121187762Sluigi            ^E        forw-line
122159636Soleg            ^N        forw-line
12398943Sluigi            k         back-line
12498943Sluigi            y         back-line
12598943Sluigi            ^Y        back-line
12698943Sluigi            ^K        back-line
12798943Sluigi            ^P        back-line
12898943Sluigi            J         forw-line-force
12998943Sluigi            K         back-line-force
13098943Sluigi            Y         back-line-force
13198943Sluigi            d         forw-scroll
13298943Sluigi            ^D        forw-scroll
13398943Sluigi            u         back-scroll
13498943Sluigi            ^U        back-scroll
13598943Sluigi            \40  forw-screen
13698943Sluigi            f         forw-screen
13798943Sluigi            ^F        forw-screen
13898943Sluigi            ^V        forw-screen
13998943Sluigi            \kD  forw-screen
14098943Sluigi            b         back-screen
14198943Sluigi            ^B        back-screen
14298943Sluigi            \ev       back-screen
14398943Sluigi            \kU  back-screen
14498943Sluigi            z         forw-window
14598943Sluigi            w         back-window
14698943Sluigi            \e\40          forw-screen-force
14798943Sluigi            F         forw-forever
14898943Sluigi            R         repaint-flush
14998943Sluigi            r         repaint
15098943Sluigi            ^R        repaint
15198943Sluigi            ^L        repaint
15298943Sluigi            \eu       undo-hilite
15398943Sluigi            g         goto-line
15498943Sluigi            \kh  goto-line
15598943Sluigi            <         goto-line
15698943Sluigi            \e<       goto-line
15798943Sluigi            p         percent
15898943Sluigi            %         percent
15998943Sluigi            \e[       left-scroll
16098943Sluigi            \e]       right-scroll
16198943Sluigi            \e(       left-scroll
16298943Sluigi            \e)       right-scroll
16398943Sluigi            {         forw-bracket {}
164172801Srpaulo            }         back-bracket {}
165172801Srpaulo            (         forw-bracket ()
16698943Sluigi            )         back-bracket ()
16798943Sluigi            [         forw-bracket []
16898943Sluigi            ]         back-bracket []
16998943Sluigi            \e^F      forw-bracket
17098943Sluigi            \e^B      back-bracket
17198943Sluigi            G         goto-end
17298943Sluigi            \e>       goto-end
17398943Sluigi            >         goto-end
17498943Sluigi            \ke  goto-end
17598943Sluigi            =         status
17698943Sluigi            ^G        status
17798943Sluigi            :f        status
17898943Sluigi            /         forw-search
17998943Sluigi            ?         back-search
18098943Sluigi            \e/       forw-search *
18198943Sluigi            \e?       back-search *
18298943Sluigi            n         repeat-search
18398943Sluigi            \en       repeat-search-all
18498943Sluigi            N         reverse-search
18598943Sluigi            \eN       reverse-search-all
18698943Sluigi            m         set-mark
18798943Sluigi            '         goto-mark
18898943Sluigi            ^X^X      goto-mark
18998943Sluigi            E         examine
19098943Sluigi            :e        examine
19198943Sluigi            ^X^V      examine
19298943Sluigi            :n        next-file
19398943Sluigi            :p        prev-file
19498943Sluigi            t         next-tag
19598943Sluigi            T         prev-tag
19698943Sluigi            :x        index-file
19798943Sluigi            :d        remove-file
19898943Sluigi            -         toggle-option
19998943Sluigi            :t        toggle-option t
20098943Sluigi            s         toggle-option o
20198943Sluigi            _         display-option
20298943Sluigi            |         pipe
20398943Sluigi            v         visual
20498943Sluigi            !         shell
20598943Sluigi            +         firstcmd
20698943Sluigi            H         help
20798943Sluigi            h         help
20898943Sluigi            V         version
20998943Sluigi            0         digit
21098943Sluigi            1         digit
21198943Sluigi            2         digit
21298943Sluigi            3         digit
213187769Sluigi            4         digit
21498943Sluigi            5         digit
21598943Sluigi            6         digit
21698943Sluigi            7         digit
21798943Sluigi            8         digit
21898943Sluigi            9         digit
21998943Sluigi            q         quit
22098943Sluigi            Q         quit
22198943Sluigi            :q        quit
22298943Sluigi            :Q        quit
223141351Sglebius            ZZ        quit
224141351Sglebius
22598943Sluigi
22698943Sluigi[1mPRECEDENCE[0m
22798943Sluigi       Commands specified by [4mlesskey[24m take precedence  over  the  default  com-
22898943Sluigi       mands.   A  default  command key may be disabled by including it in the
22998943Sluigi       input file with the action "invalid".   Alternatively,  a  key  may  be
23098943Sluigi       defined  to  do  nothing by using the action "noaction".  "noaction" is
231149020Sbz       similar to "invalid", but [4mless[24m will give an error beep for an "invalid"
23298943Sluigi       command,  but  not  for a "noaction" command.  In addition, ALL default
233149020Sbz       commands may be disabled by adding this control line to the input file:
23499475Sluigi
23598943Sluigi       #stop
236117469Sluigi
237220802Sglebius       This  will  cause  all  default commands to be ignored.  The #stop line
238190633Spiso       should be the last line in that section of the file.
239178888Sjulian
240223666Sae       Be aware that #stop can be dangerous.  Since all default  commands  are
241223666Sae       disabled, you must provide sufficient commands before the #stop line to
242117328Sluigi       enable all necessary actions.  For example, failure to provide a "quit"
24398943Sluigi       command can lead to frustration.
24498943Sluigi
245187769Sluigi
246136071Sgreen[1mLINE EDITING SECTION[0m
247136071Sgreen       The line-editing section begins with the line:
248158879Soleg
249158879Soleg       #line-edit
250136071Sgreen
251136071Sgreen       This  section specifies new key bindings for the line editing commands,
252136071Sgreen       in a manner similar to the way key bindings for ordinary  commands  are
253200567Sluigi       specified  in  the #command section.  The line-editing section consists
254200567Sluigi       of a list of keys and actions, one per line as in the example below.
255200567Sluigi
256200567Sluigi
257200567Sluigi[1mEXAMPLE[0m
258200567Sluigi       The following input file describes the set of default line-editing keys
259200567Sluigi       used by less:
260205169Sluigi
261200567Sluigi            #line-edit
262187769Sluigi            \t        forw-complete
263158879Soleg            \17       back-complete
26498943Sluigi            \e\t      back-complete
26598943Sluigi            ^L        expand
266133600Scsjp            ^V        literal
26798943Sluigi            ^A        literal
26898943Sluigi            \el       right
26998943Sluigi            \kr       right
27098943Sluigi            \eh       left
27198943Sluigi            \kl       left
27298943Sluigi            \eb       word-left
273136073Sgreen            \e\kl     word-left
274136073Sgreen            \ew       word-right
275136073Sgreen            \e\kr     word-right
27698943Sluigi            \ei       insert
27798943Sluigi            \ex       delete
27898943Sluigi            \kx       delete
27998943Sluigi            \eX       word-delete
28098943Sluigi            \ekx      word-delete
281178888Sjulian            \e\b      word-backspace
28298943Sluigi            \e0       home
28398943Sluigi            \kh       home
28498943Sluigi            \e$       end
28598943Sluigi            \ke       end
28698943Sluigi            \ek       up
287205169Sluigi            \ku       up
28898943Sluigi            \ej       down
28998943Sluigi
29098943Sluigi
29198943Sluigi
29298943Sluigi[1mLESS ENVIRONMENT VARIABLES[0m
29398943Sluigi       The environment variable section begins with the line
29498943Sluigi
295215179Sluigi       #env
296136075Sgreen
29798943Sluigi       Following  this  line  is  a  list of environment variable assignments.
29898943Sluigi       Each line consists of an environment variable name, an equals sign  (=)
29998943Sluigi       and  the value to be assigned to the environment variable.  White space
30098943Sluigi       before and after the equals sign is  ignored.   Variables  assigned  in
30198943Sluigi       this  way  are visible only to [4mless.[24m  If a variable is specified in the
30298943Sluigi       system environment and also in a lesskey file, the value in the lesskey
30398943Sluigi       file  takes precedence.  Although the lesskey file can be used to over-
30499909Sluigi       ride variables set in the environment, the main  purpose  of  assigning
30598943Sluigi       variables  in the lesskey file is simply to have all [4mless[24m configuration
306102087Sluigi       information stored in one file.
307102087Sluigi
308102087Sluigi
309102087Sluigi[1mEXAMPLE[0m
310102087Sluigi       The following input file sets the -i option whenever [4mless[24m is  run,  and
311102087Sluigi       specifies the character set to be "latin1":
312102087Sluigi
313102087Sluigi            #env
314112250Scjc            LESS = -i
315128575Sandre            LESSCHARSET = latin1
316133387Sandre
317117241Sluigi
318145246Sbrooks
319145246Sbrooks[1mSEE ALSO[0m
320145246Sbrooks       less(1)
321145246Sbrooks
322145246Sbrooks
323145246Sbrooks[1mWARNINGS[0m
324146894Smlaier       It  is not possible to specify special keys, such as uparrow, in a key-
325146894Smlaier       board-independent manner.  The only way to  specify  such  keys  is  to
326145246Sbrooks       specify the escape sequence which a particular keyboard sends when such
327145246Sbrooks       a key is pressed.
328145246Sbrooks
329145246Sbrooks       On MS-DOS and OS/2 systems, certain keys send a sequence of  characters
330200567Sluigi       which  start  with  a  NUL character (0).  This NUL character should be
331117469Sluigi       represented as \340 in a lesskey file.
33298943Sluigi
33398943Sluigi
33498943Sluigi[1mCOPYRIGHT[0m
33598943Sluigi       Copyright (C) 2000-2007  Mark Nudelman
33698943Sluigi
337101641Sluigi       lesskey is part of the GNU project and is free software; you can redis-
338101641Sluigi       tribute  it  and/or modify it under the terms of the GNU General Public
339101641Sluigi       License as published by the Free Software Foundation; either version 2,
340101641Sluigi       or (at your option) any later version.
341117328Sluigi
34298943Sluigi       lesskey  is distributed in the hope that it will be useful, but WITHOUT
34398943Sluigi       ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY  or
344206843Sluigi       FITNESS  FOR  A PARTICULAR PURPOSE.  See the GNU General Public License
345206843Sluigi       for more details.
346206843Sluigi
347206843Sluigi       You should have received a copy of the GNU General Public License along
348206843Sluigi       with lesskey; see the file COPYING.  If not, write to the Free Software
349187787Sluigi       Foundation, 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
350206843Sluigi
351206843Sluigi
352187787Sluigi[1mAUTHOR[0m
353206843Sluigi       Mark Nudelman <markn@greenwoodsoftware.com>
354206843Sluigi       Send  bug  reports  or  comments  to  the  above  address  or  to  bug-
355206843Sluigi       less@gnu.org.
356206843Sluigi
357206843Sluigi
358206846Sluigi
359206846Sluigi
360115793Sticso                           Version 415: 15 Nov 2007                 LESSKEY(1)
361206846Sluigi