2.SH NAME 3lesskey \- specify key bindings for less 4.SH SYNOPSIS 5.B "lesskey [-o output] [--] [input]" 6.br 7.B "lesskey [--output=output] [--] [input]" 8.br 9.B "lesskey -V" 10.br 11.B "lesskey --version" 12.SH DESCRIPTION 13.I Lesskey 14is used to specify a set of key bindings to be used by 15.I less. 16The input file is a text file which describes the key bindings, 17If the input file is "-", standard input is read. 18If no input file is specified, a standard filename is used 19as the name of the input file, which depends on the system being used: 20On Unix systems, $HOME/.lesskey is used; 21on MS-DOS systems, $HOME/_lesskey is used; 22and on OS/2 systems $HOME/lesskey.ini is used, 23or $INIT/lesskey.ini if $HOME is undefined. 24The output file is a binary file which is used by 25.I less. 26If no output file is specified, 27and the environment variable LESSKEY is set, 28the value of LESSKEY is used as the name of the output file. 29Otherwise, a standard filename is used as the name of the output file, 30which depends on the system being used: 31On Unix and OS-9 systems, $HOME/.less is used; 32on MS-DOS systems, $HOME/_less is used; 33and on OS/2 systems, $HOME/less.ini is used, 34or $INIT/less.ini if $HOME is undefined. 35If the output file already exists, 36.I lesskey 37will overwrite it. 38.PP 39The -V or --version option causes 40.I lesskey 41to print its version number and immediately exit. 42If -V or --version is present, other options and arguments are ignored. 43.PP 44The input file consists of one or more 45.I sections. 46Each section starts with a line that identifies the type of section. 47Possible sections are: 48.IP #command 49Defines new command keys. 50.IP #line-edit 51Defines new line-editing keys. 52.IP #env 53Defines environment variables. 54.PP 55Blank lines and lines which start with a pound sign (#) are ignored, 56except for the special section header lines. 57 58.SH "COMMAND SECTION" 59The command section begins with the line 60.sp 61#command 62.sp 63If the command section is the first section in the file, 64this line may be omitted. 65The command section consists of lines of the form: 66.sp 67 \fIstring\fP <whitespace> \fIaction\fP [extra-string] <newline> 68.sp 69Whitespace is any sequence of one or more spaces and/or tabs. 70The \fIstring\fP is the command key(s) which invoke the action. 71The \fIstring\fP may be a single command key, or a sequence of up to 15 keys. 72The \fIaction\fP is the name of the less action, from the list below. 73The characters in the \fIstring\fP may appear literally, or be 74prefixed by a caret to indicate a control key. 75A backslash followed by one to three octal digits may be used to 76specify a character by its octal value. 77A backslash followed by certain characters specifies input 78characters as follows: 79.IP \eb 80BACKSPACE 81.IP \ee 82ESCAPE 83.IP \en 84NEWLINE 85.IP \er 86RETURN 87.IP \et 88TAB 89.IP \eku 90UP ARROW 91.IP \ekd 92DOWN ARROW 93.IP \ekr 94RIGHT ARROW 95.IP \ekl 96LEFT ARROW 97.IP \ekU 98PAGE UP 99.IP \ekD 100PAGE DOWN 101.IP \ekh 102HOME 103.IP \eke 104END 105.IP \ekx 106DELETE 107.PP 108A backslash followed by any other character indicates that character is 109to be taken literally. 110Characters which must be preceded by backslash include 111caret, space, tab and the backslash itself. 112.PP 113An action may be followed by an "extra" string. 114When such a command is entered while running 115.I less, 116the action is performed, and then the extra 117string is parsed, just as if it were typed in to 118.I less. 119This feature can be used in certain cases to extend 120the functionality of a command. 121For example, see the "{" and ":t" commands in the example below. 122The extra string has a special meaning for the "quit" action: 123when 124.I less 125quits, first character of the extra string is used as its exit status. 126 127.SH EXAMPLE 128The following input file describes the set of 129default command keys used by less: 130.sp 131.nf 132 #command 133 \er forw-line 134 \en forw-line 135 e forw-line 136 j forw-line 137 \ekd forw-line 138 ^E forw-line 139 ^N forw-line 140 k back-line 141 y back-line 142 ^Y back-line 143 ^K back-line 144 ^P back-line 145 J forw-line-force 146 K back-line-force 147 Y back-line-force 148 d forw-scroll 149 ^D forw-scroll 150 u back-scroll 151 ^U back-scroll 152 \e40 forw-screen 153 f forw-screen 154 ^F forw-screen 155 ^V forw-screen 156 \ekD forw-screen 157 b back-screen 158 ^B back-screen 159 \eev back-screen 160 \ekU back-screen 161 z forw-window 162 w back-window 163 \ee\e40 forw-screen-force 164 F forw-forever 165 R repaint-flush 166 r repaint 167 ^R repaint 168 ^L repaint 169 \eeu undo-hilite 170 g goto-line 171 \ekh goto-line 172 < goto-line 173 \ee< goto-line 174 p percent 175 % percent 176 \ee[ left-scroll 177 \ee] right-scroll 178 \ee( left-scroll 179 \ee) right-scroll 180 { forw-bracket {} 181 } back-bracket {} 182 ( forw-bracket () 183 ) back-bracket () 184 [ forw-bracket [] 185 ] back-bracket [] 186 \ee^F forw-bracket 187 \ee^B back-bracket 188 G goto-end 189 \ee> goto-end 190 > goto-end 191 \eke goto-end 192 = status 193 ^G status 194 :f status 195 / forw-search 196 ? back-search 197 \ee/ forw-search * 198 \ee? back-search * 199 n repeat-search 200 \een repeat-search-all 201 N reverse-search 202 \eeN reverse-search-all 203 m set-mark 204 ' goto-mark 205 ^X^X goto-mark 206 E examine 207 :e examine 208 ^X^V examine 209 :n next-file 210 :p prev-file 211 t next-tag 212 T prev-tag 213 :x index-file 214 :d remove-file 215 - toggle-option 216 :t toggle-option t 217 s toggle-option o 218 _ display-option 219 | pipe 220 v visual 221 ! shell 222 + firstcmd 223 H help 224 h help 225 V version 226 0 digit 227 1 digit 228 2 digit 229 3 digit 230 4 digit 231 5 digit 232 6 digit 233 7 digit 234 8 digit 235 9 digit 236 q quit 237 Q quit 238 :q quit 239 :Q quit 240 ZZ quit 241.fi 242.sp 243.SH PRECEDENCE 244Commands specified by 245.I lesskey 246take precedence over the default commands. 247A default command key may be disabled by including it in the 248input file with the action "invalid". 249Alternatively, a key may be defined 250to do nothing by using the action "noaction". 251"noaction" is similar to "invalid", but 252.I less 253will give an error beep for an "invalid" command, 254but not for a "noaction" command. 255In addition, ALL default commands may be disabled by 256adding this control line to the input file: 257.sp 258#stop 259.sp 260This will cause all default commands to be ignored. 261The #stop line should be the last line in that section of the file. 262.PP 263Be aware that #stop can be dangerous. 264Since all default commands are disabled, 265you must provide sufficient commands before the #stop line 266to enable all necessary actions. 267For example, failure to provide a "quit" command can lead to frustration. 268 269.SH "LINE EDITING SECTION" 270The line-editing section begins with the line: 271.sp 272#line-edit 273.sp 274This section specifies new key bindings for the line editing commands, 275in a manner similar to the way key bindings for 276ordinary commands are specified in the #command section. 277The line-editing section consists of a list of keys and actions, 278one per line as in the example below. 279 280.SH EXAMPLE 281The following input file describes the set of 282default line-editing keys used by less: 283.sp 284.nf 285 #line-edit 286 \et forw-complete 287 \e17 back-complete 288 \ee\et back-complete 289 ^L expand 290 ^V literal 291 ^A literal 292 \eel right 293 \ekr right 294 \eeh left 295 \ekl left 296 \eeb word-left 297 \ee\ekl word-left 298 \eew word-right 299 \ee\ekr word-right 300 \eei insert 301 \eex delete 302 \ekx delete 303 \eeX word-delete 304 \eekx word-delete 305 \ee\eb word-backspace 306 \ee0 home 307 \ekh home 308 \ee$ end 309 \eke end 310 \eek up 311 \eku up 312 \eej down 313.fi 314.sp 315 316.SH "LESS ENVIRONMENT VARIABLES" 317The environment variable section begins with the line 318.sp 319#env 320.sp 321Following this line is a list of environment variable assignments. 322Each line consists of an environment variable name, an equals sign (=) 323and the value to be assigned to the environment variable. 324White space before and after the equals sign is ignored. 325Variables assigned in this way are visible only to 326.I less. 327If a variable is specified in the system environment and also in a 328lesskey file, the value in the lesskey file takes precedence. 329Although the lesskey file can be used to override variables set in the 330environment, the main purpose of assigning variables in the lesskey file 331is simply to have all 332.I less 333configuration information stored in one file. 334 335.SH EXAMPLE 336The following input file sets the -i option whenever 337.I less 338is run, and specifies the character set to be "latin1": 339.sp 340.nf 341 #env 342 LESS = -i 343 LESSCHARSET = latin1 344.fi 345.sp 346 347.SH "SEE ALSO" 348less(1) 349 350.SH WARNINGS 351It is not possible to specify special keys, such as uparrow, 352in a keyboard-independent manner. 353The only way to specify such keys is to specify the escape sequence 354which a particular keyboard sends when such a key is pressed. 355.PP 356On MS-DOS and OS/2 systems, certain keys send a sequence of characters 357which start with a NUL character (0). 358This NUL character should be represented as \e340 in a lesskey file. 359 360.SH COPYRIGHT 361Copyright (C) 2000-2007 Mark Nudelman 362.PP 363lesskey is part of the GNU project and is free software; 364you can redistribute it and/or modify it 365under the terms of the GNU General Public License as published by 366the Free Software Foundation; 367either version 2, or (at your option) any later version. 368.PP 369lesskey is distributed in the hope that it will be useful, but 370WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 371or FITNESS FOR A PARTICULAR PURPOSE. 372See the GNU General Public License for more details. 373.PP 374You should have received a copy of the GNU General Public License 375along with lesskey; see the file COPYING. 376If not, write to the Free Software Foundation, 59 Temple Place, 377Suite 330, Boston, MA 02111-1307, USA. 378 379.SH AUTHOR 380.PP 381Mark Nudelman <markn@greenwoodsoftware.com> 382.br 383Send bug reports or comments to the above address or to bug-less@gnu.org. 384
| 2.SH NAME 3lesskey \- specify key bindings for less 4.SH SYNOPSIS 5.B "lesskey [-o output] [--] [input]" 6.br 7.B "lesskey [--output=output] [--] [input]" 8.br 9.B "lesskey -V" 10.br 11.B "lesskey --version" 12.SH DESCRIPTION 13.I Lesskey 14is used to specify a set of key bindings to be used by 15.I less. 16The input file is a text file which describes the key bindings, 17If the input file is "-", standard input is read. 18If no input file is specified, a standard filename is used 19as the name of the input file, which depends on the system being used: 20On Unix systems, $HOME/.lesskey is used; 21on MS-DOS systems, $HOME/_lesskey is used; 22and on OS/2 systems $HOME/lesskey.ini is used, 23or $INIT/lesskey.ini if $HOME is undefined. 24The output file is a binary file which is used by 25.I less. 26If no output file is specified, 27and the environment variable LESSKEY is set, 28the value of LESSKEY is used as the name of the output file. 29Otherwise, a standard filename is used as the name of the output file, 30which depends on the system being used: 31On Unix and OS-9 systems, $HOME/.less is used; 32on MS-DOS systems, $HOME/_less is used; 33and on OS/2 systems, $HOME/less.ini is used, 34or $INIT/less.ini if $HOME is undefined. 35If the output file already exists, 36.I lesskey 37will overwrite it. 38.PP 39The -V or --version option causes 40.I lesskey 41to print its version number and immediately exit. 42If -V or --version is present, other options and arguments are ignored. 43.PP 44The input file consists of one or more 45.I sections. 46Each section starts with a line that identifies the type of section. 47Possible sections are: 48.IP #command 49Defines new command keys. 50.IP #line-edit 51Defines new line-editing keys. 52.IP #env 53Defines environment variables. 54.PP 55Blank lines and lines which start with a pound sign (#) are ignored, 56except for the special section header lines. 57 58.SH "COMMAND SECTION" 59The command section begins with the line 60.sp 61#command 62.sp 63If the command section is the first section in the file, 64this line may be omitted. 65The command section consists of lines of the form: 66.sp 67 \fIstring\fP <whitespace> \fIaction\fP [extra-string] <newline> 68.sp 69Whitespace is any sequence of one or more spaces and/or tabs. 70The \fIstring\fP is the command key(s) which invoke the action. 71The \fIstring\fP may be a single command key, or a sequence of up to 15 keys. 72The \fIaction\fP is the name of the less action, from the list below. 73The characters in the \fIstring\fP may appear literally, or be 74prefixed by a caret to indicate a control key. 75A backslash followed by one to three octal digits may be used to 76specify a character by its octal value. 77A backslash followed by certain characters specifies input 78characters as follows: 79.IP \eb 80BACKSPACE 81.IP \ee 82ESCAPE 83.IP \en 84NEWLINE 85.IP \er 86RETURN 87.IP \et 88TAB 89.IP \eku 90UP ARROW 91.IP \ekd 92DOWN ARROW 93.IP \ekr 94RIGHT ARROW 95.IP \ekl 96LEFT ARROW 97.IP \ekU 98PAGE UP 99.IP \ekD 100PAGE DOWN 101.IP \ekh 102HOME 103.IP \eke 104END 105.IP \ekx 106DELETE 107.PP 108A backslash followed by any other character indicates that character is 109to be taken literally. 110Characters which must be preceded by backslash include 111caret, space, tab and the backslash itself. 112.PP 113An action may be followed by an "extra" string. 114When such a command is entered while running 115.I less, 116the action is performed, and then the extra 117string is parsed, just as if it were typed in to 118.I less. 119This feature can be used in certain cases to extend 120the functionality of a command. 121For example, see the "{" and ":t" commands in the example below. 122The extra string has a special meaning for the "quit" action: 123when 124.I less 125quits, first character of the extra string is used as its exit status. 126 127.SH EXAMPLE 128The following input file describes the set of 129default command keys used by less: 130.sp 131.nf 132 #command 133 \er forw-line 134 \en forw-line 135 e forw-line 136 j forw-line 137 \ekd forw-line 138 ^E forw-line 139 ^N forw-line 140 k back-line 141 y back-line 142 ^Y back-line 143 ^K back-line 144 ^P back-line 145 J forw-line-force 146 K back-line-force 147 Y back-line-force 148 d forw-scroll 149 ^D forw-scroll 150 u back-scroll 151 ^U back-scroll 152 \e40 forw-screen 153 f forw-screen 154 ^F forw-screen 155 ^V forw-screen 156 \ekD forw-screen 157 b back-screen 158 ^B back-screen 159 \eev back-screen 160 \ekU back-screen 161 z forw-window 162 w back-window 163 \ee\e40 forw-screen-force 164 F forw-forever 165 R repaint-flush 166 r repaint 167 ^R repaint 168 ^L repaint 169 \eeu undo-hilite 170 g goto-line 171 \ekh goto-line 172 < goto-line 173 \ee< goto-line 174 p percent 175 % percent 176 \ee[ left-scroll 177 \ee] right-scroll 178 \ee( left-scroll 179 \ee) right-scroll 180 { forw-bracket {} 181 } back-bracket {} 182 ( forw-bracket () 183 ) back-bracket () 184 [ forw-bracket [] 185 ] back-bracket [] 186 \ee^F forw-bracket 187 \ee^B back-bracket 188 G goto-end 189 \ee> goto-end 190 > goto-end 191 \eke goto-end 192 = status 193 ^G status 194 :f status 195 / forw-search 196 ? back-search 197 \ee/ forw-search * 198 \ee? back-search * 199 n repeat-search 200 \een repeat-search-all 201 N reverse-search 202 \eeN reverse-search-all 203 m set-mark 204 ' goto-mark 205 ^X^X goto-mark 206 E examine 207 :e examine 208 ^X^V examine 209 :n next-file 210 :p prev-file 211 t next-tag 212 T prev-tag 213 :x index-file 214 :d remove-file 215 - toggle-option 216 :t toggle-option t 217 s toggle-option o 218 _ display-option 219 | pipe 220 v visual 221 ! shell 222 + firstcmd 223 H help 224 h help 225 V version 226 0 digit 227 1 digit 228 2 digit 229 3 digit 230 4 digit 231 5 digit 232 6 digit 233 7 digit 234 8 digit 235 9 digit 236 q quit 237 Q quit 238 :q quit 239 :Q quit 240 ZZ quit 241.fi 242.sp 243.SH PRECEDENCE 244Commands specified by 245.I lesskey 246take precedence over the default commands. 247A default command key may be disabled by including it in the 248input file with the action "invalid". 249Alternatively, a key may be defined 250to do nothing by using the action "noaction". 251"noaction" is similar to "invalid", but 252.I less 253will give an error beep for an "invalid" command, 254but not for a "noaction" command. 255In addition, ALL default commands may be disabled by 256adding this control line to the input file: 257.sp 258#stop 259.sp 260This will cause all default commands to be ignored. 261The #stop line should be the last line in that section of the file. 262.PP 263Be aware that #stop can be dangerous. 264Since all default commands are disabled, 265you must provide sufficient commands before the #stop line 266to enable all necessary actions. 267For example, failure to provide a "quit" command can lead to frustration. 268 269.SH "LINE EDITING SECTION" 270The line-editing section begins with the line: 271.sp 272#line-edit 273.sp 274This section specifies new key bindings for the line editing commands, 275in a manner similar to the way key bindings for 276ordinary commands are specified in the #command section. 277The line-editing section consists of a list of keys and actions, 278one per line as in the example below. 279 280.SH EXAMPLE 281The following input file describes the set of 282default line-editing keys used by less: 283.sp 284.nf 285 #line-edit 286 \et forw-complete 287 \e17 back-complete 288 \ee\et back-complete 289 ^L expand 290 ^V literal 291 ^A literal 292 \eel right 293 \ekr right 294 \eeh left 295 \ekl left 296 \eeb word-left 297 \ee\ekl word-left 298 \eew word-right 299 \ee\ekr word-right 300 \eei insert 301 \eex delete 302 \ekx delete 303 \eeX word-delete 304 \eekx word-delete 305 \ee\eb word-backspace 306 \ee0 home 307 \ekh home 308 \ee$ end 309 \eke end 310 \eek up 311 \eku up 312 \eej down 313.fi 314.sp 315 316.SH "LESS ENVIRONMENT VARIABLES" 317The environment variable section begins with the line 318.sp 319#env 320.sp 321Following this line is a list of environment variable assignments. 322Each line consists of an environment variable name, an equals sign (=) 323and the value to be assigned to the environment variable. 324White space before and after the equals sign is ignored. 325Variables assigned in this way are visible only to 326.I less. 327If a variable is specified in the system environment and also in a 328lesskey file, the value in the lesskey file takes precedence. 329Although the lesskey file can be used to override variables set in the 330environment, the main purpose of assigning variables in the lesskey file 331is simply to have all 332.I less 333configuration information stored in one file. 334 335.SH EXAMPLE 336The following input file sets the -i option whenever 337.I less 338is run, and specifies the character set to be "latin1": 339.sp 340.nf 341 #env 342 LESS = -i 343 LESSCHARSET = latin1 344.fi 345.sp 346 347.SH "SEE ALSO" 348less(1) 349 350.SH WARNINGS 351It is not possible to specify special keys, such as uparrow, 352in a keyboard-independent manner. 353The only way to specify such keys is to specify the escape sequence 354which a particular keyboard sends when such a key is pressed. 355.PP 356On MS-DOS and OS/2 systems, certain keys send a sequence of characters 357which start with a NUL character (0). 358This NUL character should be represented as \e340 in a lesskey file. 359 360.SH COPYRIGHT 361Copyright (C) 2000-2007 Mark Nudelman 362.PP 363lesskey is part of the GNU project and is free software; 364you can redistribute it and/or modify it 365under the terms of the GNU General Public License as published by 366the Free Software Foundation; 367either version 2, or (at your option) any later version. 368.PP 369lesskey is distributed in the hope that it will be useful, but 370WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 371or FITNESS FOR A PARTICULAR PURPOSE. 372See the GNU General Public License for more details. 373.PP 374You should have received a copy of the GNU General Public License 375along with lesskey; see the file COPYING. 376If not, write to the Free Software Foundation, 59 Temple Place, 377Suite 330, Boston, MA 02111-1307, USA. 378 379.SH AUTHOR 380.PP 381Mark Nudelman <markn@greenwoodsoftware.com> 382.br 383Send bug reports or comments to the above address or to bug-less@gnu.org. 384
|