lesskey.man revision 172597
1200581SrdivackyLESSKEY(1) LESSKEY(1) 2200581Srdivacky 3200581Srdivacky 4200581Srdivacky 5200581Srdivacky[1mNAME[0m 6200581Srdivacky lesskey - specify key bindings for less 7200581Srdivacky 8200581Srdivacky[1mSYNOPSIS[0m 9200581Srdivacky [1mlesskey [-o output] [--] [input][0m 10200581Srdivacky [1mlesskey [--output=output] [--] [input][0m 11200581Srdivacky [1mlesskey -V[0m 12200581Srdivacky [1mlesskey --version[0m 13200581Srdivacky 14263508Sdim[1mDESCRIPTION[0m 15200581Srdivacky [4mLesskey[24m is used to specify a set of key bindings to be used by [4mless.[0m 16200581Srdivacky The input file is a text file which describes the key bindings, If the 17200581Srdivacky input file is "-", standard input is read. If no input file is speci- 18200581Srdivacky fied, a standard filename is used as the name of the input file, which 19200581Srdivacky depends on the system being used: On Unix systems, $HOME/.lesskey is 20200581Srdivacky used; on MS-DOS systems, $HOME/_lesskey is used; and on OS/2 systems 21203954Srdivacky $HOME/lesskey.ini is used, or $INIT/lesskey.ini if $HOME is undefined. 22200581Srdivacky The output file is a binary file which is used by [4mless.[24m If no output 23200581Srdivacky file is specified, and the environment variable LESSKEY is set, the 24200581Srdivacky value of LESSKEY is used as the name of the output file. Otherwise, a 25263508Sdim standard filename is used as the name of the output file, which depends 26263508Sdim on the system being used: On Unix and OS-9 systems, $HOME/.less is 27263508Sdim used; on MS-DOS systems, $HOME/_less is used; and on OS/2 systems, 28263508Sdim $HOME/less.ini is used, or $INIT/less.ini if $HOME is undefined. If 29263508Sdim the output file already exists, [4mlesskey[24m will overwrite it. 30201360Srdivacky 31243830Sdim The -V or --version option causes [4mlesskey[24m to print its version number 32200581Srdivacky and immediately exit. If -V or --version is present, other options and 33239462Sdim arguments are ignored. 34263508Sdim 35239462Sdim The input file consists of one or more [4msections.[24m Each section starts 36239462Sdim with a line that identifies the type of section. Possible sections 37239462Sdim are: 38239462Sdim 39263508Sdim #command 40212904Sdim Defines new command keys. 41212904Sdim 42200581Srdivacky #line-edit 43212904Sdim Defines new line-editing keys. 44212904Sdim 45212904Sdim #env Defines environment variables. 46212904Sdim 47212904Sdim Blank lines and lines which start with a pound sign (#) are ignored, 48212904Sdim except for the special section header lines. 49212904Sdim 50212904Sdim 51212904Sdim[1mCOMMAND SECTION[0m 52212904Sdim The command section begins with the line 53212904Sdim 54212904Sdim #command 55212904Sdim 56212904Sdim If the command section is the first section in the file, this line may 57200581Srdivacky be omitted. The command section consists of lines of the form: 58212904Sdim 59212904Sdim [4mstring[24m <whitespace> [4maction[24m [extra-string] <newline> 60200581Srdivacky 61212904Sdim Whitespace is any sequence of one or more spaces and/or tabs. The 62212904Sdim [4mstring[24m is the command key(s) which invoke the action. The [4mstring[24m may 63200581Srdivacky be a single command key, or a sequence of up to 15 keys. The [4maction[24m is 64212904Sdim the name of the less action, from the list below. The characters in 65200581Srdivacky the [4mstring[24m may appear literally, or be prefixed by a caret to indicate 66212904Sdim a control key. A backslash followed by one to three octal digits may 67212904Sdim be used to specify a character by its octal value. A backslash fol- 68212904Sdim lowed by certain characters specifies input characters as follows: 69212904Sdim 70212904Sdim \b BACKSPACE 71212904Sdim 72212904Sdim \e ESCAPE 73212904Sdim 74239462Sdim \n NEWLINE 75239462Sdim 76239462Sdim \r RETURN 77239462Sdim 78239462Sdim \t TAB 79239462Sdim 80239462Sdim \ku UP ARROW 81239462Sdim 82239462Sdim \kd DOWN ARROW 83239462Sdim 84239462Sdim \kr RIGHT ARROW 85239462Sdim 86239462Sdim \kl LEFT ARROW 87239462Sdim 88239462Sdim \kU PAGE UP 89239462Sdim 90239462Sdim \kD PAGE DOWN 91239462Sdim 92239462Sdim \kh HOME 93239462Sdim 94239462Sdim \ke END 95263508Sdim 96263508Sdim \kx DELETE 97221345Sdim 98221345Sdim A backslash followed by any other character indicates that character is 99212904Sdim to be taken literally. Characters which must be preceded by backslash 100212904Sdim include caret, space, tab and the backslash itself. 101212904Sdim 102212904Sdim An action may be followed by an "extra" string. When such a command is 103212904Sdim entered while running [4mless,[24m the action is performed, and then the extra 104212904Sdim string is parsed, just as if it were typed in to [4mless.[24m This feature 105251662Sdim can be used in certain cases to extend the functionality of a command. 106212904Sdim For example, see the "{" and ":t" commands in the example below. The 107212904Sdim extra string has a special meaning for the "quit" action: when [4mless[0m 108212904Sdim quits, first character of the extra string is used as its exit status. 109212904Sdim 110212904Sdim 111212904Sdim[1mEXAMPLE[0m 112221345Sdim The following input file describes the set of default command keys used 113221345Sdim by less: 114221345Sdim 115212904Sdim #command 116212904Sdim \r forw-line 117212904Sdim \n forw-line 118212904Sdim e forw-line 119212904Sdim j forw-line 120212904Sdim \kd forw-line 121212904Sdim ^E forw-line 122221345Sdim ^N forw-line 123221345Sdim k back-line 124221345Sdim y back-line 125221345Sdim ^Y back-line 126221345Sdim ^K back-line 127221345Sdim ^P back-line 128221345Sdim J forw-line-force 129221345Sdim K back-line-force 130200581Srdivacky Y back-line-force 131221345Sdim d forw-scroll 132221345Sdim ^D forw-scroll 133221345Sdim u back-scroll 134263508Sdim ^U back-scroll 135263508Sdim \40 forw-screen 136200581Srdivacky f forw-screen 137221345Sdim ^F forw-screen 138221345Sdim ^V forw-screen 139221345Sdim \kD forw-screen 140200581Srdivacky b back-screen 141221345Sdim ^B back-screen 142221345Sdim \ev back-screen 143200581Srdivacky \kU back-screen 144212904Sdim z forw-window 145212904Sdim w back-window 146212904Sdim \e\40 forw-screen-force 147212904Sdim F forw-forever 148212904Sdim R repaint-flush 149212904Sdim r repaint 150221345Sdim ^R repaint 151212904Sdim ^L repaint 152243830Sdim \eu undo-hilite 153212904Sdim g goto-line 154212904Sdim \kh goto-line 155212904Sdim < goto-line 156212904Sdim \e< goto-line 157200581Srdivacky p percent 158200581Srdivacky % percent 159212904Sdim \e[ left-scroll 160221345Sdim \e] right-scroll 161212904Sdim \e( left-scroll 162212904Sdim \e) right-scroll 163212904Sdim { forw-bracket {} 164212904Sdim } back-bracket {} 165221345Sdim ( forw-bracket () 166212904Sdim ) back-bracket () 167212904Sdim [ forw-bracket [] 168212904Sdim ] back-bracket [] 169221345Sdim \e^F forw-bracket 170221345Sdim \e^B back-bracket 171221345Sdim G goto-end 172221345Sdim \e> goto-end 173212904Sdim > goto-end 174223017Sdim \ke goto-end 175212904Sdim = status 176212904Sdim ^G status 177212904Sdim :f status 178212904Sdim / forw-search 179212904Sdim ? back-search 180239462Sdim \e/ forw-search * 181212904Sdim \e? back-search * 182212904Sdim n repeat-search 183239462Sdim \en repeat-search-all 184239462Sdim N reverse-search 185212904Sdim \eN reverse-search-all 186263508Sdim m set-mark 187200581Srdivacky ' goto-mark 188 ^X^X goto-mark 189 E examine 190 :e examine 191 ^X^V examine 192 :n next-file 193 :p prev-file 194 t next-tag 195 T prev-tag 196 :x index-file 197 :d remove-file 198 - toggle-option 199 :t toggle-option t 200 s toggle-option o 201 _ display-option 202 | pipe 203 v visual 204 ! shell 205 + firstcmd 206 H help 207 h help 208 V version 209 0 digit 210 1 digit 211 2 digit 212 3 digit 213 4 digit 214 5 digit 215 6 digit 216 7 digit 217 8 digit 218 9 digit 219 q quit 220 Q quit 221 :q quit 222 :Q quit 223 ZZ quit 224 225 226[1mPRECEDENCE[0m 227 Commands specified by [4mlesskey[24m take precedence over the default com- 228 mands. A default command key may be disabled by including it in the 229 input file with the action "invalid". Alternatively, a key may be 230 defined to do nothing by using the action "noaction". "noaction" is 231 similar to "invalid", but [4mless[24m will give an error beep for an "invalid" 232 command, but not for a "noaction" command. In addition, ALL default 233 commands may be disabled by adding this control line to the input file: 234 235 #stop 236 237 This will cause all default commands to be ignored. The #stop line 238 should be the last line in that section of the file. 239 240 Be aware that #stop can be dangerous. Since all default commands are 241 disabled, you must provide sufficient commands before the #stop line to 242 enable all necessary actions. For example, failure to provide a "quit" 243 command can lead to frustration. 244 245 246[1mLINE EDITING SECTION[0m 247 The line-editing section begins with the line: 248 249 #line-edit 250 251 This section specifies new key bindings for the line editing commands, 252 in a manner similar to the way key bindings for ordinary commands are 253 specified in the #command section. The line-editing section consists 254 of a list of keys and actions, one per line as in the example below. 255 256 257[1mEXAMPLE[0m 258 The following input file describes the set of default line-editing keys 259 used by less: 260 261 #line-edit 262 \t forw-complete 263 \17 back-complete 264 \e\t back-complete 265 ^L expand 266 ^V literal 267 ^A literal 268 \el right 269 \kr right 270 \eh left 271 \kl left 272 \eb word-left 273 \e\kl word-left 274 \ew word-right 275 \e\kr word-right 276 \ei insert 277 \ex delete 278 \kx delete 279 \eX word-delete 280 \ekx word-delete 281 \e\b word-backspace 282 \e0 home 283 \kh home 284 \e$ end 285 \ke end 286 \ek up 287 \ku up 288 \ej down 289 290 291 292[1mLESS ENVIRONMENT VARIABLES[0m 293 The environment variable section begins with the line 294 295 #env 296 297 Following this line is a list of environment variable assignments. 298 Each line consists of an environment variable name, an equals sign (=) 299 and the value to be assigned to the environment variable. White space 300 before and after the equals sign is ignored. Variables assigned in 301 this way are visible only to [4mless.[24m If a variable is specified in the 302 system environment and also in a lesskey file, the value in the lesskey 303 file takes precedence. Although the lesskey file can be used to over- 304 ride variables set in the environment, the main purpose of assigning 305 variables in the lesskey file is simply to have all [4mless[24m configuration 306 information stored in one file. 307 308 309[1mEXAMPLE[0m 310 The following input file sets the -i option whenever [4mless[24m is run, and 311 specifies the character set to be "latin1": 312 313 #env 314 LESS = -i 315 LESSCHARSET = latin1 316 317 318 319[1mSEE ALSO[0m 320 less(1) 321 322 323[1mWARNINGS[0m 324 It is not possible to specify special keys, such as uparrow, in a key- 325 board-independent manner. The only way to specify such keys is to 326 specify the escape sequence which a particular keyboard sends when such 327 a key is pressed. 328 329 On MS-DOS and OS/2 systems, certain keys send a sequence of characters 330 which start with a NUL character (0). This NUL character should be 331 represented as \340 in a lesskey file. 332 333 334[1mCOPYRIGHT[0m 335 Copyright (C) 2000-2007 Mark Nudelman 336 337 lesskey is part of the GNU project and is free software; you can redis- 338 tribute it and/or modify it under the terms of the GNU General Public 339 License as published by the Free Software Foundation; either version 2, 340 or (at your option) any later version. 341 342 lesskey is distributed in the hope that it will be useful, but WITHOUT 343 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 344 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 345 for more details. 346 347 You should have received a copy of the GNU General Public License along 348 with lesskey; see the file COPYING. If not, write to the Free Software 349 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 350 351 352[1mAUTHOR[0m 353 Mark Nudelman <markn@greenwoodsoftware.com> 354 Send bug reports or comments to the above address or to bug- 355 less@gnu.org. 356 357 358 359 360 Version 409: 12 Oct 2007 LESSKEY(1) 361