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 148240121Sdelphij \eF forw-until-hilite 14960786Sps R repaint-flush 15060786Sps r repaint 15160786Sps ^R repaint 15260786Sps ^L repaint 15360786Sps \eu undo-hilite 15460786Sps g goto-line 15589019Sps \kh goto-line 15660786Sps < goto-line 15760786Sps \e< goto-line 15860786Sps p percent 15989019Sps % percent 16060786Sps \e[ left-scroll 16160786Sps \e] right-scroll 16260786Sps \e( left-scroll 16360786Sps \e) right-scroll 16460786Sps { forw-bracket {} 16560786Sps } back-bracket {} 16660786Sps ( forw-bracket () 16760786Sps ) back-bracket () 16860786Sps [ forw-bracket [] 16960786Sps ] back-bracket [] 17060786Sps \e^F forw-bracket 17160786Sps \e^B back-bracket 17260786Sps G goto-end 17360786Sps \e> goto-end 17460786Sps > goto-end 17589019Sps \ke goto-end 17660786Sps = status 17760786Sps ^G status 17860786Sps :f status 17960786Sps / forw-search 18060786Sps ? back-search 18160786Sps \e/ forw-search * 18260786Sps \e? back-search * 18360786Sps n repeat-search 18460786Sps \en repeat-search-all 18560786Sps N reverse-search 18660786Sps \eN reverse-search-all 187191930Sdelphij & filter 18860786Sps m set-mark 18960786Sps ' goto-mark 19060786Sps ^X^X goto-mark 19160786Sps E examine 19260786Sps :e examine 19360786Sps ^X^V examine 19460786Sps :n next-file 19560786Sps :p prev-file 19689019Sps t next-tag 19789019Sps T prev-tag 19860786Sps :x index-file 19989019Sps :d remove-file 20060786Sps - toggle-option 20160786Sps :t toggle-option t 20260786Sps s toggle-option o 20360786Sps _ display-option 20460786Sps | pipe 20560786Sps v visual 20660786Sps ! shell 20760786Sps + firstcmd 20860786Sps H help 20960786Sps h help 21060786Sps V version 21163128Sps 0 digit 21263128Sps 1 digit 21363128Sps 2 digit 21489019Sps 3 digit 21589019Sps 4 digit 21689019Sps 5 digit 21789019Sps 6 digit 21889019Sps 7 digit 21963128Sps 8 digit 22063128Sps 9 digit 22163128Sps q quit 22263128Sps Q quit 22363128Sps :q quit 22463128Sps :Q quit 22563128Sps ZZ quit 22660786Sps 22760786Sps 228170256Sdelphij[1mPRECEDENCE[0m 229221715Sdelphij Commands specified by [4mlesskey[24m take precedence over the default com- 230221715Sdelphij mands. A default command key may be disabled by including it in the 231221715Sdelphij input file with the action "invalid". Alternatively, a key may be 232221715Sdelphij defined to do nothing by using the action "noaction". "noaction" is 233170256Sdelphij similar to "invalid", but [4mless[24m will give an error beep for an "invalid" 234221715Sdelphij command, but not for a "noaction" command. In addition, ALL default 235161475Sdelphij commands may be disabled by adding this control line to the input file: 23660786Sps 23760786Sps #stop 23860786Sps 239161475Sdelphij This will cause all default commands to be ignored. The #stop line 240161475Sdelphij should be the last line in that section of the file. 24160786Sps 242161475Sdelphij Be aware that #stop can be dangerous. Since all default commands are 243161475Sdelphij disabled, you must provide sufficient commands before the #stop line to 244161475Sdelphij enable all necessary actions. For example, failure to provide a "quit" 245161475Sdelphij command can lead to frustration. 24660786Sps 24760786Sps 248170256Sdelphij[1mLINE EDITING SECTION[0m 24960786Sps The line-editing section begins with the line: 25060786Sps 25160786Sps #line-edit 25260786Sps 253161475Sdelphij This section specifies new key bindings for the line editing commands, 254161475Sdelphij in a manner similar to the way key bindings for ordinary commands are 255161475Sdelphij specified in the #command section. The line-editing section consists 256161475Sdelphij of a list of keys and actions, one per line as in the example below. 25760786Sps 25860786Sps 259170256Sdelphij[1mEXAMPLE[0m 260161475Sdelphij The following input file describes the set of default line-editing keys 261161475Sdelphij used by less: 26260786Sps 26389019Sps #line-edit 26489019Sps \t forw-complete 26589019Sps \17 back-complete 26689019Sps \e\t back-complete 26789019Sps ^L expand 26863128Sps ^V literal 26963128Sps ^A literal 27063128Sps \el right 27163128Sps \kr right 27263128Sps \eh left 27363128Sps \kl left 27463128Sps \eb word-left 27563128Sps \e\kl word-left 27663128Sps \ew word-right 27760786Sps \e\kr word-right 27860786Sps \ei insert 27960786Sps \ex delete 28060786Sps \kx delete 28160786Sps \eX word-delete 28260786Sps \ekx word-delete 28360786Sps \e\b word-backspace 28460786Sps \e0 home 28560786Sps \kh home 28660786Sps \e$ end 28760786Sps \ke end 28860786Sps \ek up 28960786Sps \ku up 29060786Sps \ej down 291221715Sdelphij ^G abort 29260786Sps 29360786Sps 29460786Sps 295170256Sdelphij[1mLESS ENVIRONMENT VARIABLES[0m 29660786Sps The environment variable section begins with the line 29760786Sps 29860786Sps #env 29960786Sps 300161475Sdelphij Following this line is a list of environment variable assignments. 301161475Sdelphij Each line consists of an environment variable name, an equals sign (=) 302161475Sdelphij and the value to be assigned to the environment variable. White space 303161475Sdelphij before and after the equals sign is ignored. Variables assigned in 304170256Sdelphij this way are visible only to [4mless.[24m If a variable is specified in the 305161475Sdelphij system environment and also in a lesskey file, the value in the lesskey 306161475Sdelphij file takes precedence. Although the lesskey file can be used to over- 307161475Sdelphij ride variables set in the environment, the main purpose of assigning 308170256Sdelphij variables in the lesskey file is simply to have all [4mless[24m configuration 30960786Sps information stored in one file. 31060786Sps 31160786Sps 312170256Sdelphij[1mEXAMPLE[0m 313170256Sdelphij The following input file sets the -i option whenever [4mless[24m is run, and 314161475Sdelphij specifies the character set to be "latin1": 31560786Sps 31689019Sps #env 31789019Sps LESS = -i 31889019Sps LESSCHARSET = latin1 31960786Sps 32060786Sps 32189019Sps 322170256Sdelphij[1mSEE ALSO[0m 32363128Sps less(1) 32460786Sps 32560786Sps 326170256Sdelphij[1mWARNINGS[0m 327221715Sdelphij On MS-DOS and OS/2 systems, certain keys send a sequence of characters 328221715Sdelphij which start with a NUL character (0). This NUL character should be 329161475Sdelphij represented as \340 in a lesskey file. 33060786Sps 33160786Sps 332170256Sdelphij[1mCOPYRIGHT[0m 333240121Sdelphij Copyright (C) 2000-2012 Mark Nudelman 33460786Sps 335161475Sdelphij lesskey is part of the GNU project and is free software; you can redis- 336221715Sdelphij tribute it and/or modify it under the terms of the GNU General Public 337161475Sdelphij License as published by the Free Software Foundation; either version 2, 338161475Sdelphij or (at your option) any later version. 33960786Sps 340221715Sdelphij lesskey is distributed in the hope that it will be useful, but WITHOUT 341221715Sdelphij ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 342221715Sdelphij FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 343161475Sdelphij for more details. 34460786Sps 345161475Sdelphij You should have received a copy of the GNU General Public License along 346161475Sdelphij with lesskey; see the file COPYING. If not, write to the Free Software 347161475Sdelphij Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 34860786Sps 34960786Sps 350170256Sdelphij[1mAUTHOR[0m 351240121Sdelphij Mark Nudelman <bug-less@gnu.org> 352240121Sdelphij Send bug reports or comments to bug-less@gnu.org. 35360786Sps 35460786Sps 35560786Sps 356251154Sdelphij Version 458: 04 Apr 2013 LESSKEY(1) 357