lesskey.man revision 161475
1161475SdelphijLESSKEY(1)                                                          LESSKEY(1)
260786Sps
360786Sps
460786Sps
560786SpsNNAAMMEE
660786Sps       lesskey - specify key bindings for less
760786Sps
860786SpsSSYYNNOOPPSSIISS
960786Sps       lleesssskkeeyy [[--oo oouuttppuutt]] [[----]] [[iinnppuutt]]
1060786Sps       lleesssskkeeyy [[----oouuttppuutt==oouuttppuutt]] [[----]] [[iinnppuutt]]
1160786Sps       lleesssskkeeyy --VV
1260786Sps       lleesssskkeeyy ----vveerrssiioonn
1360786Sps
1460786SpsDDEESSCCRRIIPPTTIIOONN
15161475Sdelphij       _L_e_s_s_k_e_y  is  used  to specify a set of key bindings to be used by _l_e_s_s_.
16161475Sdelphij       The input file is a text file which describes the key bindings, If  the
17161475Sdelphij       input  file is "-", standard input is read.  If no input file is speci-
18161475Sdelphij       fied, a standard filename is used as the name of the input file,  which
19161475Sdelphij       depends  on  the  system being used: On Unix systems, $HOME/.lesskey is
20161475Sdelphij       used; on MS-DOS systems, $HOME/_lesskey is used; and  on  OS/2  systems
21161475Sdelphij       $HOME/lesskey.ini  is used, or $INIT/lesskey.ini if $HOME is undefined.
22161475Sdelphij       The output file is a binary file which is used by _l_e_s_s_.  If  no  output
23161475Sdelphij       file  is  specified,  and  the environment variable LESSKEY is set, the
24161475Sdelphij       value of LESSKEY is used as the name of the output file.  Otherwise,  a
25161475Sdelphij       standard filename is used as the name of the output file, which depends
26161475Sdelphij       on the system being used: On Unix  and  OS-9  systems,  $HOME/.less  is
27161475Sdelphij       used;  on  MS-DOS  systems,  $HOME/_less  is used; and on OS/2 systems,
28161475Sdelphij       $HOME/less.ini is used, or $INIT/less.ini if $HOME  is  undefined.   If
29161475Sdelphij       the output file already exists, _l_e_s_s_k_e_y will overwrite it.
3060786Sps
31161475Sdelphij       The  -V  or --version option causes _l_e_s_s_k_e_y to print its version number
32161475Sdelphij       and immediately exit.  If -V or --version is present, other options and
33161475Sdelphij       arguments are ignored.
3460786Sps
35161475Sdelphij       The  input  file consists of one or more _s_e_c_t_i_o_n_s_.  Each section starts
36161475Sdelphij       with a line that identifies the type  of  section.   Possible  sections
37161475Sdelphij       are:
3860786Sps
3960786Sps       #command
4060786Sps              Defines new command keys.
4160786Sps
4260786Sps       #line-edit
4360786Sps              Defines new line-editing keys.
4460786Sps
4560786Sps       #env   Defines environment variables.
4660786Sps
47161475Sdelphij       Blank  lines  and  lines which start with a pound sign (#) are ignored,
48161475Sdelphij       except for the special section header lines.
4960786Sps
5060786Sps
5160786SpsCCOOMMMMAANNDD SSEECCTTIIOONN
5260786Sps       The command section begins with the line
5360786Sps
5460786Sps       #command
5560786Sps
56161475Sdelphij       If the command section is the first section in the file, this line  may
57161475Sdelphij       be omitted.  The command section consists of lines of the form:
5860786Sps
5960786Sps            _s_t_r_i_n_g <whitespace> _a_c_t_i_o_n [extra-string] <newline>
6060786Sps
61161475Sdelphij       Whitespace  is  any  sequence  of  one or more spaces and/or tabs.  The
62161475Sdelphij       _s_t_r_i_n_g is the command key(s) which invoke the action.  The  _s_t_r_i_n_g  may
63161475Sdelphij       be a single command key, or a sequence of up to 15 keys.  The _a_c_t_i_o_n is
64161475Sdelphij       the name of the less action, from the list below.   The  characters  in
65161475Sdelphij       the  _s_t_r_i_n_g may appear literally, or be prefixed by a caret to indicate
66161475Sdelphij       a control key.  A backslash followed by one to three octal  digits  may
67161475Sdelphij       be  used  to  specify a character by its octal value.  A backslash fol-
68161475Sdelphij       lowed by certain characters specifies input characters as follows:
6960786Sps
7060786Sps       \b     BACKSPACE
7160786Sps
7260786Sps       \e     ESCAPE
7360786Sps
7460786Sps       \n     NEWLINE
7560786Sps
7660786Sps       \r     RETURN
7760786Sps
7860786Sps       \t     TAB
7960786Sps
8060786Sps       \ku    UP ARROW
8160786Sps
8260786Sps       \kd    DOWN ARROW
8360786Sps
8460786Sps       \kr    RIGHT ARROW
8560786Sps
8660786Sps       \kl    LEFT ARROW
8760786Sps
8860786Sps       \kU    PAGE UP
8960786Sps
9060786Sps       \kD    PAGE DOWN
9160786Sps
9260786Sps       \kh    HOME
9360786Sps
9460786Sps       \ke    END
9560786Sps
9660786Sps       \kx    DELETE
9760786Sps
98161475Sdelphij       A backslash followed by any other character indicates that character is
99161475Sdelphij       to  be taken literally.  Characters which must be preceded by backslash
100161475Sdelphij       include caret, space, tab and the backslash itself.
10160786Sps
102161475Sdelphij       An action may be followed by an "extra" string.  When such a command is
103161475Sdelphij       entered while running _l_e_s_s_, the action is performed, and then the extra
104161475Sdelphij       string is parsed, just as if it were typed in to  _l_e_s_s_.   This  feature
105161475Sdelphij       can  be used in certain cases to extend the functionality of a command.
106161475Sdelphij       For example, see the "{" and ":t" commands in the example  below.   The
107161475Sdelphij       extra  string  has  a  special meaning for the "quit" action: when _l_e_s_s
108161475Sdelphij       quits, first character of the extra string is used as its exit  status.
10960786Sps
11060786Sps
11160786SpsEEXXAAMMPPLLEE
112161475Sdelphij       The following input file describes the set of default command keys used
113161475Sdelphij       by less:
11460786Sps
11560786Sps            #command
11660786Sps            \r        forw-line
11760786Sps            \n        forw-line
11860786Sps            e         forw-line
11960786Sps            j         forw-line
12060786Sps            \kd  forw-line
12160786Sps            ^E        forw-line
12260786Sps            ^N        forw-line
12360786Sps            k         back-line
12460786Sps            y         back-line
12560786Sps            ^Y        back-line
12660786Sps            ^K        back-line
12760786Sps            ^P        back-line
12860786Sps            J         forw-line-force
12960786Sps            K         back-line-force
13060786Sps            Y         back-line-force
13160786Sps            d         forw-scroll
13260786Sps            ^D        forw-scroll
13360786Sps            u         back-scroll
13460786Sps            ^U        back-scroll
13560786Sps            \40  forw-screen
13660786Sps            f         forw-screen
13760786Sps            ^F        forw-screen
13860786Sps            ^V        forw-screen
13960786Sps            \kD  forw-screen
14060786Sps            b         back-screen
14160786Sps            ^B        back-screen
14260786Sps            \ev       back-screen
14360786Sps            \kU  back-screen
14460786Sps            z         forw-window
14560786Sps            w         back-window
14660786Sps            \e\40          forw-screen-force
14760786Sps            F         forw-forever
14860786Sps            R         repaint-flush
14960786Sps            r         repaint
15060786Sps            ^R        repaint
15160786Sps            ^L        repaint
15260786Sps            \eu       undo-hilite
15360786Sps            g         goto-line
15489019Sps            \kh  goto-line
15560786Sps            <         goto-line
15660786Sps            \e<       goto-line
15760786Sps            p         percent
15889019Sps            %         percent
15960786Sps            \e[       left-scroll
16060786Sps            \e]       right-scroll
16160786Sps            \e(       left-scroll
16260786Sps            \e)       right-scroll
16360786Sps            {         forw-bracket {}
16460786Sps            }         back-bracket {}
16560786Sps            (         forw-bracket ()
16660786Sps            )         back-bracket ()
16760786Sps            [         forw-bracket []
16860786Sps            ]         back-bracket []
16960786Sps            \e^F      forw-bracket
17060786Sps            \e^B      back-bracket
17160786Sps            G         goto-end
17260786Sps            \e>       goto-end
17360786Sps            >         goto-end
17489019Sps            \ke  goto-end
17560786Sps            =         status
17660786Sps            ^G        status
17760786Sps            :f        status
17860786Sps            /         forw-search
17960786Sps            ?         back-search
18060786Sps            \e/       forw-search *
18160786Sps            \e?       back-search *
18260786Sps            n         repeat-search
18360786Sps            \en       repeat-search-all
18460786Sps            N         reverse-search
18560786Sps            \eN       reverse-search-all
18660786Sps            m         set-mark
18760786Sps            '         goto-mark
18860786Sps            ^X^X      goto-mark
18960786Sps            E         examine
19060786Sps            :e        examine
19160786Sps            ^X^V      examine
19260786Sps            :n        next-file
19360786Sps            :p        prev-file
19489019Sps            t         next-tag
19589019Sps            T         prev-tag
19660786Sps            :x        index-file
19789019Sps            :d        remove-file
19860786Sps            -         toggle-option
19960786Sps            :t        toggle-option t
20060786Sps            s         toggle-option o
20160786Sps            _         display-option
20260786Sps            |         pipe
20360786Sps            v         visual
20460786Sps            !         shell
20560786Sps            +         firstcmd
20660786Sps            H         help
20760786Sps            h         help
20860786Sps            V         version
20963128Sps            0         digit
21063128Sps            1         digit
21163128Sps            2         digit
21289019Sps            3         digit
21389019Sps            4         digit
21489019Sps            5         digit
21589019Sps            6         digit
21689019Sps            7         digit
21763128Sps            8         digit
21863128Sps            9         digit
21963128Sps            q         quit
22063128Sps            Q         quit
22163128Sps            :q        quit
22263128Sps            :Q        quit
22363128Sps            ZZ        quit
22460786Sps
22560786Sps
22660786SpsPPRREECCEEDDEENNCCEE
227161475Sdelphij       Commands specified by _l_e_s_s_k_e_y take precedence  over  the  default  com-
228161475Sdelphij       mands.   A  default  command key may be disabled by including it in the
229161475Sdelphij       input file with the action "invalid".   Alternatively,  a  key  may  be
230161475Sdelphij       defined  to  do  nothing by using the action "noaction".  "noaction" is
231161475Sdelphij       similar to "invalid", but _l_e_s_s will give an error beep for an "invalid"
232161475Sdelphij       command,  but  not  for a "noaction" command.  In addition, ALL default
233161475Sdelphij       commands may be disabled by adding this control line to the input file:
23460786Sps
23560786Sps       #stop
23660786Sps
237161475Sdelphij       This  will  cause  all  default commands to be ignored.  The #stop line
238161475Sdelphij       should be the last line in that section of the file.
23960786Sps
240161475Sdelphij       Be aware that #stop can be dangerous.  Since all default  commands  are
241161475Sdelphij       disabled, you must provide sufficient commands before the #stop line to
242161475Sdelphij       enable all necessary actions.  For example, failure to provide a "quit"
243161475Sdelphij       command can lead to frustration.
24460786Sps
24560786Sps
24660786SpsLLIINNEE EEDDIITTIINNGG SSEECCTTIIOONN
24760786Sps       The line-editing section begins with the line:
24860786Sps
24960786Sps       #line-edit
25060786Sps
251161475Sdelphij       This  section specifies new key bindings for the line editing commands,
252161475Sdelphij       in a manner similar to the way key bindings for ordinary  commands  are
253161475Sdelphij       specified  in  the #command section.  The line-editing section consists
254161475Sdelphij       of a list of keys and actions, one per line as in the example below.
25560786Sps
25660786Sps
25760786SpsEEXXAAMMPPLLEE
258161475Sdelphij       The following input file describes the set of default line-editing keys
259161475Sdelphij       used by less:
26060786Sps
26189019Sps            #line-edit
26289019Sps            \t        forw-complete
26389019Sps            \17       back-complete
26489019Sps            \e\t      back-complete
26589019Sps            ^L        expand
26663128Sps            ^V        literal
26763128Sps            ^A        literal
26863128Sps            \el       right
26963128Sps            \kr       right
27063128Sps            \eh       left
27163128Sps            \kl       left
27263128Sps            \eb       word-left
27363128Sps            \e\kl     word-left
27463128Sps            \ew       word-right
27560786Sps            \e\kr     word-right
27660786Sps            \ei       insert
27760786Sps            \ex       delete
27860786Sps            \kx       delete
27960786Sps            \eX       word-delete
28060786Sps            \ekx      word-delete
28160786Sps            \e\b      word-backspace
28260786Sps            \e0       home
28360786Sps            \kh       home
28460786Sps            \e$       end
28560786Sps            \ke       end
28660786Sps            \ek       up
28760786Sps            \ku       up
28860786Sps            \ej       down
28960786Sps
29060786Sps
29160786Sps
29260786SpsLLEESSSS EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
29360786Sps       The environment variable section begins with the line
29460786Sps
29560786Sps       #env
29660786Sps
297161475Sdelphij       Following  this  line  is  a  list of environment variable assignments.
298161475Sdelphij       Each line consists of an environment variable name, an equals sign  (=)
299161475Sdelphij       and  the value to be assigned to the environment variable.  White space
300161475Sdelphij       before and after the equals sign is  ignored.   Variables  assigned  in
301161475Sdelphij       this  way  are visible only to _l_e_s_s_.  If a variable is specified in the
302161475Sdelphij       system environment and also in a lesskey file, the value in the lesskey
303161475Sdelphij       file  takes precedence.  Although the lesskey file can be used to over-
304161475Sdelphij       ride variables set in the environment, the main  purpose  of  assigning
305161475Sdelphij       variables  in the lesskey file is simply to have all _l_e_s_s configuration
30660786Sps       information stored in one file.
30760786Sps
30860786Sps
30960786SpsEEXXAAMMPPLLEE
310161475Sdelphij       The following input file sets the -i option whenever _l_e_s_s is  run,  and
311161475Sdelphij       specifies the character set to be "latin1":
31260786Sps
31389019Sps            #env
31489019Sps            LESS = -i
31589019Sps            LESSCHARSET = latin1
31660786Sps
31760786Sps
31889019Sps
31963128SpsSSEEEE AALLSSOO
32063128Sps       less(1)
32160786Sps
32260786Sps
32363128SpsWWAARRNNIINNGGSS
324161475Sdelphij       It  is not possible to specify special keys, such as uparrow, in a key-
325161475Sdelphij       board-independent manner.  The only way to  specify  such  keys  is  to
326161475Sdelphij       specify the escape sequence which a particular keyboard sends when such
327161475Sdelphij       a key is pressed.
32860786Sps
329161475Sdelphij       On MS-DOS and OS/2 systems, certain keys send a sequence of  characters
330161475Sdelphij       which  start  with  a  NUL character (0).  This NUL character should be
331161475Sdelphij       represented as \340 in a lesskey file.
33260786Sps
33360786Sps
33460786SpsCCOOPPYYRRIIGGHHTT
335161475Sdelphij       Copyright (C) 2004  Mark Nudelman
33660786Sps
337161475Sdelphij       lesskey is part of the GNU project and is free software; you can redis-
338161475Sdelphij       tribute  it  and/or modify it under the terms of the GNU General Public
339161475Sdelphij       License as published by the Free Software Foundation; either version 2,
340161475Sdelphij       or (at your option) any later version.
34160786Sps
342161475Sdelphij       lesskey  is distributed in the hope that it will be useful, but WITHOUT
343161475Sdelphij       ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY  or
344161475Sdelphij       FITNESS  FOR  A PARTICULAR PURPOSE.  See the GNU General Public License
345161475Sdelphij       for more details.
34660786Sps
347161475Sdelphij       You should have received a copy of the GNU General Public License along
348161475Sdelphij       with lesskey; see the file COPYING.  If not, write to the Free Software
349161475Sdelphij       Foundation, 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
35060786Sps
35160786Sps
35260786SpsAAUUTTHHOORR
35389019Sps       Mark Nudelman <markn@greenwoodsoftware.com>
354161475Sdelphij       Send  bug  reports  or  comments  to  the  above  address  or  to  bug-
355161475Sdelphij       less@gnu.org.
35660786Sps
35760786Sps
35860786Sps
35960786Sps
360161475Sdelphij                           Version 394: 03 Dec 2005                 LESSKEY(1)
361