lesskey.man revision 191930
1219004ShselaskyLESSKEY(1) LESSKEY(1) 2219004Shselasky 3219004Shselasky 4219004Shselasky 5219004Shselasky[1mNAME[0m 6219004Shselasky lesskey - specify key bindings for less 7219004Shselasky 8219004Shselasky[1mSYNOPSIS[0m 9219004Shselasky [1mlesskey [-o output] [--] [input][0m 10219004Shselasky [1mlesskey [--output=output] [--] [input][0m 11219004Shselasky [1mlesskey -V[0m 12219004Shselasky [1mlesskey --version[0m 13219004Shselasky 14219004Shselasky[1mDESCRIPTION[0m 15219004Shselasky [4mLesskey[24m is used to specify a set of key bindings to be used by [4mless.[0m 16219004Shselasky The input file is a text file which describes the key bindings, If the 17219004Shselasky input file is "-", standard input is read. If no input file is speci- 18219004Shselasky fied, a standard filename is used as the name of the input file, which 19219004Shselasky depends on the system being used: On Unix systems, $HOME/.lesskey is 20219004Shselasky used; on MS-DOS systems, $HOME/_lesskey is used; and on OS/2 systems 21219004Shselasky $HOME/lesskey.ini is used, or $INIT/lesskey.ini if $HOME is undefined. 22219004Shselasky The output file is a binary file which is used by [4mless.[24m If no output 23219004Shselasky file is specified, and the environment variable LESSKEY is set, the 24219004Shselasky value of LESSKEY is used as the name of the output file. Otherwise, a 25219004Shselasky standard filename is used as the name of the output file, which depends 26219004Shselasky on the system being used: On Unix and OS-9 systems, $HOME/.less is 27222019Sru used; on MS-DOS systems, $HOME/_less is used; and on OS/2 systems, 28219004Shselasky $HOME/less.ini is used, or $INIT/less.ini if $HOME is undefined. If 29219004Shselasky the output file already exists, [4mlesskey[24m will overwrite it. 30219004Shselasky 31219004Shselasky The -V or --version option causes [4mlesskey[24m to print its version number 32219004Shselasky and immediately exit. If -V or --version is present, other options and 33219004Shselasky arguments are ignored. 34219004Shselasky 35219004Shselasky The input file consists of one or more [4msections.[24m Each section starts 36219004Shselasky with a line that identifies the type of section. Possible sections 37219004Shselasky are: 38219004Shselasky 39219004Shselasky #command 40219004Shselasky Defines new command keys. 41219004Shselasky 42219004Shselasky #line-edit 43219004Shselasky Defines new line-editing keys. 44219004Shselasky 45219004Shselasky #env Defines environment variables. 46219004Shselasky 47219004Shselasky Blank lines and lines which start with a pound sign (#) are ignored, 48219004Shselasky except for the special section header lines. 49219004Shselasky 50219004Shselasky 51219048Shselasky[1mCOMMAND SECTION[0m 52222019Sru The command section begins with the line 53222019Sru 54222019Sru #command 55222019Sru 56222019Sru If the command section is the first section in the file, this line may 57222019Sru be omitted. The command section consists of lines of the form: 58222019Sru 59219004Shselasky [4mstring[24m <whitespace> [4maction[24m [extra-string] <newline> 60219004Shselasky 61219004Shselasky Whitespace is any sequence of one or more spaces and/or tabs. The 62219004Shselasky [4mstring[24m is the command key(s) which invoke the action. The [4mstring[24m may 63219004Shselasky be a single command key, or a sequence of up to 15 keys. The [4maction[24m is 64219004Shselasky the name of the less action, from the list below. The characters in 65219004Shselasky the [4mstring[24m may appear literally, or be prefixed by a caret to indicate 66219004Shselasky a control key. A backslash followed by one to three octal digits may 67219004Shselasky be used to specify a character by its octal value. A backslash fol- 68219004Shselasky lowed by certain characters specifies input characters as follows: 69 70 \b BACKSPACE 71 72 \e ESCAPE 73 74 \n NEWLINE 75 76 \r RETURN 77 78 \t TAB 79 80 \ku UP ARROW 81 82 \kd DOWN ARROW 83 84 \kr RIGHT ARROW 85 86 \kl LEFT ARROW 87 88 \kU PAGE UP 89 90 \kD PAGE DOWN 91 92 \kh HOME 93 94 \ke END 95 96 \kx DELETE 97 98 A backslash followed by any other character indicates that character is 99 to be taken literally. Characters which must be preceded by backslash 100 include caret, space, tab and the backslash itself. 101 102 An action may be followed by an "extra" string. When such a command is 103 entered while running [4mless,[24m the action is performed, and then the extra 104 string is parsed, just as if it were typed in to [4mless.[24m This feature 105 can be used in certain cases to extend the functionality of a command. 106 For example, see the "{" and ":t" commands in the example below. The 107 extra string has a special meaning for the "quit" action: when [4mless[0m 108 quits, first character of the extra string is used as its exit status. 109 110 111[1mEXAMPLE[0m 112 The following input file describes the set of default command keys used 113 by less: 114 115 #command 116 \r forw-line 117 \n forw-line 118 e forw-line 119 j forw-line 120 \kd forw-line 121 ^E forw-line 122 ^N forw-line 123 k back-line 124 y back-line 125 ^Y back-line 126 ^K back-line 127 ^P back-line 128 J forw-line-force 129 K back-line-force 130 Y back-line-force 131 d forw-scroll 132 ^D forw-scroll 133 u back-scroll 134 ^U back-scroll 135 \40 forw-screen 136 f forw-screen 137 ^F forw-screen 138 ^V forw-screen 139 \kD forw-screen 140 b back-screen 141 ^B back-screen 142 \ev back-screen 143 \kU back-screen 144 z forw-window 145 w back-window 146 \e\40 forw-screen-force 147 F forw-forever 148 R repaint-flush 149 r repaint 150 ^R repaint 151 ^L repaint 152 \eu undo-hilite 153 g goto-line 154 \kh goto-line 155 < goto-line 156 \e< goto-line 157 p percent 158 % percent 159 \e[ left-scroll 160 \e] right-scroll 161 \e( left-scroll 162 \e) right-scroll 163 { forw-bracket {} 164 } back-bracket {} 165 ( forw-bracket () 166 ) back-bracket () 167 [ forw-bracket [] 168 ] back-bracket [] 169 \e^F forw-bracket 170 \e^B back-bracket 171 G goto-end 172 \e> goto-end 173 > goto-end 174 \ke goto-end 175 = status 176 ^G status 177 :f status 178 / forw-search 179 ? back-search 180 \e/ forw-search * 181 \e? back-search * 182 n repeat-search 183 \en repeat-search-all 184 N reverse-search 185 \eN reverse-search-all 186 & filter 187 m set-mark 188 ' goto-mark 189 ^X^X goto-mark 190 E examine 191 :e examine 192 ^X^V examine 193 :n next-file 194 :p prev-file 195 t next-tag 196 T prev-tag 197 :x index-file 198 :d remove-file 199 - toggle-option 200 :t toggle-option t 201 s toggle-option o 202 _ display-option 203 | pipe 204 v visual 205 ! shell 206 + firstcmd 207 H help 208 h help 209 V version 210 0 digit 211 1 digit 212 2 digit 213 3 digit 214 4 digit 215 5 digit 216 6 digit 217 7 digit 218 8 digit 219 9 digit 220 q quit 221 Q quit 222 :q quit 223 :Q quit 224 ZZ quit 225 226 227[1mPRECEDENCE[0m 228 Commands specified by [4mlesskey[24m take precedence over the default com- 229 mands. A default command key may be disabled by including it in the 230 input file with the action "invalid". Alternatively, a key may be 231 defined to do nothing by using the action "noaction". "noaction" is 232 similar to "invalid", but [4mless[24m will give an error beep for an "invalid" 233 command, but not for a "noaction" command. In addition, ALL default 234 commands may be disabled by adding this control line to the input file: 235 236 #stop 237 238 This will cause all default commands to be ignored. The #stop line 239 should be the last line in that section of the file. 240 241 Be aware that #stop can be dangerous. Since all default commands are 242 disabled, you must provide sufficient commands before the #stop line to 243 enable all necessary actions. For example, failure to provide a "quit" 244 command can lead to frustration. 245 246 247[1mLINE EDITING SECTION[0m 248 The line-editing section begins with the line: 249 250 #line-edit 251 252 This section specifies new key bindings for the line editing commands, 253 in a manner similar to the way key bindings for ordinary commands are 254 specified in the #command section. The line-editing section consists 255 of a list of keys and actions, one per line as in the example below. 256 257 258[1mEXAMPLE[0m 259 The following input file describes the set of default line-editing keys 260 used by less: 261 262 #line-edit 263 \t forw-complete 264 \17 back-complete 265 \e\t back-complete 266 ^L expand 267 ^V literal 268 ^A literal 269 \el right 270 \kr right 271 \eh left 272 \kl left 273 \eb word-left 274 \e\kl word-left 275 \ew word-right 276 \e\kr word-right 277 \ei insert 278 \ex delete 279 \kx delete 280 \eX word-delete 281 \ekx word-delete 282 \e\b word-backspace 283 \e0 home 284 \kh home 285 \e$ end 286 \ke end 287 \ek up 288 \ku up 289 \ej down 290 291 292 293[1mLESS ENVIRONMENT VARIABLES[0m 294 The environment variable section begins with the line 295 296 #env 297 298 Following this line is a list of environment variable assignments. 299 Each line consists of an environment variable name, an equals sign (=) 300 and the value to be assigned to the environment variable. White space 301 before and after the equals sign is ignored. Variables assigned in 302 this way are visible only to [4mless.[24m If a variable is specified in the 303 system environment and also in a lesskey file, the value in the lesskey 304 file takes precedence. Although the lesskey file can be used to over- 305 ride variables set in the environment, the main purpose of assigning 306 variables in the lesskey file is simply to have all [4mless[24m configuration 307 information stored in one file. 308 309 310[1mEXAMPLE[0m 311 The following input file sets the -i option whenever [4mless[24m is run, and 312 specifies the character set to be "latin1": 313 314 #env 315 LESS = -i 316 LESSCHARSET = latin1 317 318 319 320[1mSEE ALSO[0m 321 less(1) 322 323 324[1mWARNINGS[0m 325 It is not possible to specify special keys, such as uparrow, in a key- 326 board-independent manner. The only way to specify such keys is to 327 specify the escape sequence which a particular keyboard sends when such 328 a key is pressed. 329 330 On MS-DOS and OS/2 systems, certain keys send a sequence of characters 331 which start with a NUL character (0). This NUL character should be 332 represented as \340 in a lesskey file. 333 334 335[1mCOPYRIGHT[0m 336 Copyright (C) 2000-2008 Mark Nudelman 337 338 lesskey is part of the GNU project and is free software; you can redis- 339 tribute it and/or modify it under the terms of the GNU General Public 340 License as published by the Free Software Foundation; either version 2, 341 or (at your option) any later version. 342 343 lesskey is distributed in the hope that it will be useful, but WITHOUT 344 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 345 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 346 for more details. 347 348 You should have received a copy of the GNU General Public License along 349 with lesskey; see the file COPYING. If not, write to the Free Software 350 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 351 352 353[1mAUTHOR[0m 354 Mark Nudelman <markn@greenwoodsoftware.com> 355 Send bug reports or comments to the above address or to bug- 356 less@gnu.org. 357 358 359 360 361 Version 429: 11 Apr 2009 LESSKEY(1) 362