lesskey.man revision 60786
1 2 3 4LESSKEY(1) LESSKEY(1) 5 6 7NNAAMMEE 8 lesskey - specify key bindings for less 9 10SSYYNNOOPPSSIISS 11 lleesssskkeeyy [[--oo oouuttppuutt]] [[----]] [[iinnppuutt]] 12 lleesssskkeeyy [[----oouuttppuutt==oouuttppuutt]] [[----]] [[iinnppuutt]] 13 lleesssskkeeyy --VV 14 lleesssskkeeyy ----vveerrssiioonn 15 16DDEESSCCRRIIPPTTIIOONN 17 _L_e_s_s_k_e_y is used to specify a set of key bindings to be 18 used by _l_e_s_s_. The input file is a text file which 19 describes the key bindings, If the input file is "-", 20 standard input is read. If no input file is specified, a 21 standard filename is used as the name of the input file, 22 which depends on the system being used: On Unix systems, 23 $HOME/.lesskey is used; on MS-DOS systems, $HOME/_lesskey 24 is used; and on OS/2 systems $HOME/lesskey.ini is used, or 25 $INIT/lesskey.ini if $HOME is undefined. The output file 26 is a binary file which is used by _l_e_s_s_. If no output file 27 is specified, and the environment variable LESSKEY is set, 28 the value of LESSKEY is used as the name of the output 29 file. Otherwise, a standard filename is used as the name 30 of the output file, which depends on the system being 31 used: On Unix and OS-9 systems, $HOME/.less is used; on 32 MS-DOS systems, $HOME/_less is used; and on OS/2 systems, 33 $HOME/less.ini is used, or $INIT/less.ini if $HOME is 34 undefined. If the output file already exists, _l_e_s_s_k_e_y 35 will overwrite it. 36 37 The -V or --version option causes _l_e_s_s_k_e_y to print its 38 version number and immediately exit. If -V or --version 39 is present, other options and arguments are ignored. 40 41 The input file consists of one or more _s_e_c_t_i_o_n_s_. Each 42 section starts with a line that identifies the type of 43 section. Possible sections are: 44 45 #command 46 Defines new command keys. 47 48 #line-edit 49 Defines new line-editing keys. 50 51 #env Defines environment variables. 52 53 Blank lines and lines which start with a pound sign (#) 54 are ignored, except for the special section header lines. 55 56 57CCOOMMMMAANNDD SSEECCTTIIOONN 58 The command section begins with the line 59 60 #command 61 62 63 64 Version 354: 23 Mar 2000 1 65 66 67 68 69 70LESSKEY(1) LESSKEY(1) 71 72 73 If the command section is the first section in the file, 74 this line may be omitted. The command section consists of 75 lines of the form: 76 77 _s_t_r_i_n_g <whitespace> _a_c_t_i_o_n [extra-string] <newline> 78 79 Whitespace is any sequence of one or more spaces and/or 80 tabs. The _s_t_r_i_n_g is the command key(s) which invoke the 81 action. The _s_t_r_i_n_g may be a single command key, or a 82 sequence of up to 15 keys. The _a_c_t_i_o_n is the name of the 83 less action, from the list below. The characters in the 84 _s_t_r_i_n_g may appear literally, or be prefixed by a caret to 85 indicate a control key. A backslash followed by one to 86 three octal digits may be used to specify a character by 87 its octal value. A backslash followed by certain charac- 88 ters specifies input characters as follows: 89 90 \b BACKSPACE 91 92 \e ESCAPE 93 94 \n NEWLINE 95 96 \r RETURN 97 98 \t TAB 99 100 \ku UP ARROW 101 102 \kd DOWN ARROW 103 104 \kr RIGHT ARROW 105 106 \kl LEFT ARROW 107 108 \kU PAGE UP 109 110 \kD PAGE DOWN 111 112 \kh HOME 113 114 \ke END 115 116 \kx DELETE 117 118 A backslash followed by any other character indicates that 119 character is to be taken literally. Characters which must 120 be preceded by backslash include caret, space, tab and the 121 backslash itself. 122 123 An action may be followed by an "extra" string. When such 124 a command is entered while running _l_e_s_s_, the action is 125 performed, and then the extra string is parsed, just as if 126 it were typed in to _l_e_s_s_. This feature can be used in 127 128 129 130 Version 354: 23 Mar 2000 2 131 132 133 134 135 136LESSKEY(1) LESSKEY(1) 137 138 139 certain cases to extend the functionality of a command. 140 For example, see the "{" and ":t" commands in the example 141 below. The extra string has a special meaning for the 142 "quit" action: when _l_e_s_s quits, first character of the 143 extra string is used as its exit status. 144 145 146EEXXAAMMPPLLEE 147 The following input file describes the set of default com- 148 mand keys used by less: 149 150 #command 151 \r forw-line 152 \n forw-line 153 e forw-line 154 j forw-line 155 \kd forw-line 156 ^E forw-line 157 ^N forw-line 158 k back-line 159 y back-line 160 ^Y back-line 161 ^K back-line 162 ^P back-line 163 J forw-line-force 164 K back-line-force 165 Y back-line-force 166 d forw-scroll 167 ^D forw-scroll 168 u back-scroll 169 ^U back-scroll 170 \40 forw-screen 171 f forw-screen 172 ^F forw-screen 173 ^V forw-screen 174 \kD forw-screen 175 b back-screen 176 ^B back-screen 177 \ev back-screen 178 \kU back-screen 179 z forw-window 180 w back-window 181 \e\40 forw-screen-force 182 F forw-forever 183 R repaint-flush 184 r repaint 185 ^R repaint 186 ^L repaint 187 \eu undo-hilite 188 g goto-line 189 < goto-line 190 \e< goto-line 191 p percent 192 % percent 193 194 195 196 Version 354: 23 Mar 2000 3 197 198 199 200 201 202LESSKEY(1) LESSKEY(1) 203 204 205 \e[ left-scroll 206 \e] right-scroll 207 \e( left-scroll 208 \e) right-scroll 209 { forw-bracket {} 210 } back-bracket {} 211 ( forw-bracket () 212 ) back-bracket () 213 [ forw-bracket [] 214 ] back-bracket [] 215 \e^F forw-bracket 216 \e^B back-bracket 217 G goto-end 218 \e> goto-end 219 > goto-end 220 = status 221 ^G status 222 :f status 223 / forw-search 224 ? back-search 225 \e/ forw-search * 226 \e? back-search * 227 n repeat-search 228 \en repeat-search-all 229 N reverse-search 230 \eN reverse-search-all 231 m set-mark 232 ' goto-mark 233 ^X^X goto-mark 234 E examine 235 :e examine 236 ^X^V examine 237 :n next-file 238 :p prev-file 239 :x index-file 240 - toggle-option 241 :t toggle-option t 242 s toggle-option o 243 _ display-option 244 | pipe 245 v visual 246 ! shell 247 + firstcmd 248 H help 249 h help 250 V version 251 q quit 252 Q quit 253 :q quit 254 :Q quit 255 ZZ quit 256 257 258 259 260 261 262 Version 354: 23 Mar 2000 4 263 264 265 266 267 268LESSKEY(1) LESSKEY(1) 269 270 271PPRREECCEEDDEENNCCEE 272 Commands specified by _l_e_s_s_k_e_y take precedence over the 273 default commands. A default command key may be disabled 274 by including it in the input file with the action 275 "invalid". Alternatively, a key may be defined to do 276 nothing by using the action "noaction". "noaction" is 277 similar to "invalid", but _l_e_s_s will give an error beep for 278 an "invalid" command, but not for a "noaction" command. 279 In addition, ALL default commands may be disabled by 280 adding this control line to the input file: 281 282 #stop 283 284 This will cause all default commands to be ignored. The 285 #stop line should be the last line in that section of the 286 file. 287 288 Be aware that #stop can be dangerous. Since all default 289 commands are disabled, you must provide sufficient com- 290 mands before the #stop line to enable all necessary 291 actions. For example, failure to provide a "quit" command 292 can lead to frustration. 293 294 295LLIINNEE EEDDIITTIINNGG SSEECCTTIIOONN 296 The line-editing section begins with the line: 297 298 #line-edit 299 300 This section specifies new key bindings for the line edit- 301 ing commands, in a manner similar to the way key bindings 302 for ordinary commands are specified in the #command sec- 303 tion. The line-editing section consists of a list of keys 304 and actions, one per line as in the example below. 305 306 307EEXXAAMMPPLLEE 308 The following input file describes the set of default 309 line-editing keys used by less: 310 311 #line-edit 312 \t forw-complete 313 \17 back-complete 314 \e\t back-complete 315 ^L expand 316 ^V literal 317 ^A literal 318 \el right 319 \kr right 320 \eh left 321 \kl left 322 \eb word-left 323 \e\kl word-left 324 \ew word-right 325 326 327 328 Version 354: 23 Mar 2000 5 329 330 331 332 333 334LESSKEY(1) LESSKEY(1) 335 336 337 \e\kr word-right 338 \ei insert 339 \ex delete 340 \kx delete 341 \eX word-delete 342 \ekx word-delete 343 \e\b word-backspace 344 \e0 home 345 \kh home 346 \e$ end 347 \ke end 348 \ek up 349 \ku up 350 \ej down 351 352 353 354LLEESSSS EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS 355 The environment variable section begins with the line 356 357 #env 358 359 Following this line is a list of environment variable 360 assignments. Each line consists of an environment vari- 361 able name, an equals sign (=) and the value to be assigned 362 to the environment variable. White space before and after 363 the equals sign is ignored. Variables assigned in this 364 way are visible only to _l_e_s_s_. If a variable is specified 365 in the system environment and also in a lesskey file, the 366 value in the lesskey file takes precedence. Although the 367 lesskey file can be used to override variables set in the 368 environment, the main purpose of assigning variables in 369 the lesskey file is simply to have all _l_e_s_s configuration 370 information stored in one file. 371 372 373EEXXAAMMPPLLEE 374 The following input file sets the -i option whenever _l_e_s_s 375 is run, and specifies the character set to be "latin1": 376 377 #env 378 LESS = -i 379 LESSCHARSET = latin1 380 381 382 383SSEEEE AALLSSOO 384 less(1) 385 386 387WWAARRNNIINNGGSS 388 It is not possible to specify special keys, such as upar- 389 row, in a keyboard-independent manner. The only way to 390 specify such keys is to specify the escape sequence which 391 392 393 394 Version 354: 23 Mar 2000 6 395 396 397 398 399 400LESSKEY(1) LESSKEY(1) 401 402 403 a particular keyboard sends when such a keys is pressed. 404 405 On MS-DOS and OS/2 systems, certain keys send a sequence 406 of characters which start with a NUL character (0). This 407 NUL character should be represented as \340 in a lesskey 408 file. 409 410 411CCOOPPYYRRIIGGHHTT 412 Copyright (C) 2000 Mark Nudelman 413 414 lesskey is part of the GNU project and is free software; 415 you can redistribute it and/or modify it under the terms 416 of the GNU General Public License as published by the Free 417 Software Foundation; either version 2, or (at your option) 418 any later version. 419 420 lesskey is distributed in the hope that it will be useful, 421 but WITHOUT ANY WARRANTY; without even the implied war- 422 ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- 423 POSE. See the GNU General Public License for more 424 details. 425 426 You should have received a copy of the GNU General Public 427 License along with lesskey; see the file COPYING. If not, 428 write to the Free Software Foundation, 59 Temple Place, 429 Suite 330, Boston, MA 02111-1307, USA. 430 431 432AAUUTTHHOORR 433 Mark Nudelman <marknu@flash.net> 434 Send bug reports or comments to the above address or to 435 bug-less@gnu.org. 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 Version 354: 23 Mar 2000 7 461 462 463