lesskey.man revision 221715
1161475SdelphijLESSKEY(1) LESSKEY(1) 260786Sps 360786Sps 460786Sps 5170256Sdelphij[1mNAME[0m 660786Sps lesskey - specify key bindings for less 760786Sps 8170256Sdelphij[1mSYNOPSIS[0m 9170256Sdelphij [1mlesskey [-o output] [--] [input][0m 10170256Sdelphij [1mlesskey [--output=output] [--] [input][0m 11170256Sdelphij [1mlesskey -V[0m 12170256Sdelphij [1mlesskey --version[0m 1360786Sps 14170256Sdelphij[1mDESCRIPTION[0m 15170256Sdelphij [4mLesskey[24m is used to specify a set of key bindings to be used by [4mless.[0m 16221715Sdelphij 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. 22170256Sdelphij The output file is a binary file which is used by [4mless.[24m 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 29170256Sdelphij the output file already exists, [4mlesskey[24m will overwrite it. 3060786Sps 31170256Sdelphij The -V or --version option causes [4mlesskey[24m to print its version number 32161475Sdelphij and immediately exit. If -V or --version is present, other options and 33161475Sdelphij arguments are ignored. 3460786Sps 35170256Sdelphij The input file consists of one or more [4msections.[24m 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 51170256Sdelphij[1mCOMMAND SECTION[0m 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 59170256Sdelphij [4mstring[24m <whitespace> [4maction[24m [extra-string] <newline> 6060786Sps 61161475Sdelphij Whitespace is any sequence of one or more spaces and/or tabs. The 62170256Sdelphij [4mstring[24m is the command key(s) which invoke the action. The [4mstring[24m may 63170256Sdelphij be a single command key, or a sequence of up to 15 keys. The [4maction[24m is 64161475Sdelphij the name of the less action, from the list below. The characters in 65170256Sdelphij the [4mstring[24m 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 103170256Sdelphij entered while running [4mless,[24m the action is performed, and then the extra 104170256Sdelphij string is parsed, just as if it were typed in to [4mless.[24m 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 107170256Sdelphij extra string has a special meaning for the "quit" action: when [4mless[0m 108221715Sdelphij quits, first character of the extra string is used as its exit status. 10960786Sps 11060786Sps 111170256Sdelphij[1mEXAMPLE[0m 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 186191930Sdelphij & filter 18760786Sps m set-mark 18860786Sps ' goto-mark 18960786Sps ^X^X goto-mark 19060786Sps E examine 19160786Sps :e examine 19260786Sps ^X^V examine 19360786Sps :n next-file 19460786Sps :p prev-file 19589019Sps t next-tag 19689019Sps T prev-tag 19760786Sps :x index-file 19889019Sps :d remove-file 19960786Sps - toggle-option 20060786Sps :t toggle-option t 20160786Sps s toggle-option o 20260786Sps _ display-option 20360786Sps | pipe 20460786Sps v visual 20560786Sps ! shell 20660786Sps + firstcmd 20760786Sps H help 20860786Sps h help 20960786Sps V version 21063128Sps 0 digit 21163128Sps 1 digit 21263128Sps 2 digit 21389019Sps 3 digit 21489019Sps 4 digit 21589019Sps 5 digit 21689019Sps 6 digit 21789019Sps 7 digit 21863128Sps 8 digit 21963128Sps 9 digit 22063128Sps q quit 22163128Sps Q quit 22263128Sps :q quit 22363128Sps :Q quit 22463128Sps ZZ quit 22560786Sps 22660786Sps 227170256Sdelphij[1mPRECEDENCE[0m 228221715Sdelphij Commands specified by [4mlesskey[24m take precedence over the default com- 229221715Sdelphij mands. A default command key may be disabled by including it in the 230221715Sdelphij input file with the action "invalid". Alternatively, a key may be 231221715Sdelphij defined to do nothing by using the action "noaction". "noaction" is 232170256Sdelphij similar to "invalid", but [4mless[24m will give an error beep for an "invalid" 233221715Sdelphij command, but not for a "noaction" command. In addition, ALL default 234161475Sdelphij commands may be disabled by adding this control line to the input file: 23560786Sps 23660786Sps #stop 23760786Sps 238161475Sdelphij This will cause all default commands to be ignored. The #stop line 239161475Sdelphij should be the last line in that section of the file. 24060786Sps 241161475Sdelphij Be aware that #stop can be dangerous. Since all default commands are 242161475Sdelphij disabled, you must provide sufficient commands before the #stop line to 243161475Sdelphij enable all necessary actions. For example, failure to provide a "quit" 244161475Sdelphij command can lead to frustration. 24560786Sps 24660786Sps 247170256Sdelphij[1mLINE EDITING SECTION[0m 24860786Sps The line-editing section begins with the line: 24960786Sps 25060786Sps #line-edit 25160786Sps 252161475Sdelphij This section specifies new key bindings for the line editing commands, 253161475Sdelphij in a manner similar to the way key bindings for ordinary commands are 254161475Sdelphij specified in the #command section. The line-editing section consists 255161475Sdelphij of a list of keys and actions, one per line as in the example below. 25660786Sps 25760786Sps 258170256Sdelphij[1mEXAMPLE[0m 259161475Sdelphij The following input file describes the set of default line-editing keys 260161475Sdelphij used by less: 26160786Sps 26289019Sps #line-edit 26389019Sps \t forw-complete 26489019Sps \17 back-complete 26589019Sps \e\t back-complete 26689019Sps ^L expand 26763128Sps ^V literal 26863128Sps ^A literal 26963128Sps \el right 27063128Sps \kr right 27163128Sps \eh left 27263128Sps \kl left 27363128Sps \eb word-left 27463128Sps \e\kl word-left 27563128Sps \ew word-right 27660786Sps \e\kr word-right 27760786Sps \ei insert 27860786Sps \ex delete 27960786Sps \kx delete 28060786Sps \eX word-delete 28160786Sps \ekx word-delete 28260786Sps \e\b word-backspace 28360786Sps \e0 home 28460786Sps \kh home 28560786Sps \e$ end 28660786Sps \ke end 28760786Sps \ek up 28860786Sps \ku up 28960786Sps \ej down 290221715Sdelphij ^G abort 29160786Sps 29260786Sps 29360786Sps 294170256Sdelphij[1mLESS ENVIRONMENT VARIABLES[0m 29560786Sps The environment variable section begins with the line 29660786Sps 29760786Sps #env 29860786Sps 299161475Sdelphij Following this line is a list of environment variable assignments. 300161475Sdelphij Each line consists of an environment variable name, an equals sign (=) 301161475Sdelphij and the value to be assigned to the environment variable. White space 302161475Sdelphij before and after the equals sign is ignored. Variables assigned in 303170256Sdelphij this way are visible only to [4mless.[24m If a variable is specified in the 304161475Sdelphij system environment and also in a lesskey file, the value in the lesskey 305161475Sdelphij file takes precedence. Although the lesskey file can be used to over- 306161475Sdelphij ride variables set in the environment, the main purpose of assigning 307170256Sdelphij variables in the lesskey file is simply to have all [4mless[24m configuration 30860786Sps information stored in one file. 30960786Sps 31060786Sps 311170256Sdelphij[1mEXAMPLE[0m 312170256Sdelphij The following input file sets the -i option whenever [4mless[24m is run, and 313161475Sdelphij specifies the character set to be "latin1": 31460786Sps 31589019Sps #env 31689019Sps LESS = -i 31789019Sps LESSCHARSET = latin1 31860786Sps 31960786Sps 32089019Sps 321170256Sdelphij[1mSEE ALSO[0m 32263128Sps less(1) 32360786Sps 32460786Sps 325170256Sdelphij[1mWARNINGS[0m 326221715Sdelphij On MS-DOS and OS/2 systems, certain keys send a sequence of characters 327221715Sdelphij which start with a NUL character (0). This NUL character should be 328161475Sdelphij represented as \340 in a lesskey file. 32960786Sps 33060786Sps 331170256Sdelphij[1mCOPYRIGHT[0m 332221715Sdelphij Copyright (C) 2000-2011 Mark Nudelman 33360786Sps 334161475Sdelphij lesskey is part of the GNU project and is free software; you can redis- 335221715Sdelphij tribute it and/or modify it under the terms of the GNU General Public 336161475Sdelphij License as published by the Free Software Foundation; either version 2, 337161475Sdelphij or (at your option) any later version. 33860786Sps 339221715Sdelphij lesskey is distributed in the hope that it will be useful, but WITHOUT 340221715Sdelphij ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 341221715Sdelphij FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 342161475Sdelphij for more details. 34360786Sps 344161475Sdelphij You should have received a copy of the GNU General Public License along 345161475Sdelphij with lesskey; see the file COPYING. If not, write to the Free Software 346161475Sdelphij Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 34760786Sps 34860786Sps 349170256Sdelphij[1mAUTHOR[0m 35089019Sps Mark Nudelman <markn@greenwoodsoftware.com> 351161475Sdelphij Send bug reports or comments to the above address or to bug- 352161475Sdelphij less@gnu.org. 35360786Sps 35460786Sps 35560786Sps 35660786Sps 357221715Sdelphij Version 443: 09 Apr 2011 LESSKEY(1) 358