| 1 | .\" |
| 2 | .\" Copyright (c) 1988 Mark Nudleman |
| 3 | .\" Copyright (c) 1988 Regents of the University of California. |
| 4 | .\" All rights reserved. |
| 5 | .\" |
| 6 | .\" This code is derived from software contributed to Berkeley by |
| 7 | .\" Mark Nudleman. |
| 8 | .\" |
| 9 | .\" Redistribution and use in source and binary forms are permitted |
| 10 | .\" provided that the above copyright notice and this paragraph are |
| 11 | .\" duplicated in all such forms and that any documentation, |
| 12 | .\" advertising materials, and other materials related to such |
| 13 | .\" distribution and use acknowledge that the software was developed |
| 14 | .\" by the University of California, Berkeley. The name of the |
| 15 | .\" University may not be used to endorse or promote products derived |
| 16 | .\" from this software without specific prior written permission. |
| 17 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
| 18 | .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 19 | .\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 20 | .\" |
| 21 | .\" @(#)more.1 5.1 (Berkeley) %G% |
| 22 | .\" |
| 23 | .TH LESS 1 |
| 24 | .SH NAME |
| 25 | less \- opposite of more |
| 26 | .SH SYNOPSIS |
| 27 | .B "less [-[+]aABcCdeEimMnqQuUsw] [-b\fIN\fB] [-h\fIN\fB] [-x\fIN\fB] [-[z]\fIN\fB]" |
| 28 | .br |
| 29 | .B " [-P[mM=]\fIstring\fB] [-[lL]\fIlogfile\fB] [+\fIcmd\fB]" |
| 30 | .br |
| 31 | .B " [-t\fItag\fB] [\fIfilename\fB]..." |
| 32 | .SH DESCRIPTION |
| 33 | .I Less |
| 34 | is a program similar to |
| 35 | .I more |
| 36 | (1), but which allows backwards movement |
| 37 | in the file as well as forward movement. |
| 38 | Also, |
| 39 | .I less |
| 40 | does not have to read the entire input file before starting, |
| 41 | so with large input files it starts up faster than text editors like |
| 42 | .I vi |
| 43 | (1). |
| 44 | .I Less |
| 45 | uses termcap (or terminfo on some systems), |
| 46 | so it can run on a variety of terminals. |
| 47 | There is even limited support for hardcopy terminals. |
| 48 | (On a hardcopy terminal, lines which should be printed at the top |
| 49 | of the screen are prefixed with an up-arrow.) |
| 50 | .PP |
| 51 | Commands are based on both |
| 52 | .I more |
| 53 | and |
| 54 | .I vi. |
| 55 | Commands may be preceeded by a decimal number, |
| 56 | called N in the descriptions below. |
| 57 | The number is used by some commands, as indicated. |
| 58 | |
| 59 | .SH COMMANDS |
| 60 | In the following descriptions, ^X means control-X. |
| 61 | ESC stands for the ESCAPE key; for example ESC-v means the |
| 62 | two character sequence "ESCAPE", then "v". |
| 63 | .IP H |
| 64 | Help: display a summary of these commands. |
| 65 | If you forget all the other commands, remember this one. |
| 66 | .PP |
| 67 | .IP "SPACE or f or ^F or ^V" |
| 68 | Scroll forward N lines, default one window (see option -z below). |
| 69 | If N is more than the screen size, only the final screenful is displayed. |
| 70 | Warning: some systems use ^V as a special literalization character. |
| 71 | .PP |
| 72 | .IP "b or ^B or ESC-v" |
| 73 | Scroll backward N lines, default one window (see option -z below). |
| 74 | If N is more than the screen size, only the final screenful is displayed. |
| 75 | .PP |
| 76 | .IP "RETURN or ^N or e or ^E or j or ^J" |
| 77 | Scroll forward N lines, default 1. |
| 78 | The entire N lines are displayed, even if N is more than the screen size. |
| 79 | .PP |
| 80 | .IP "y or ^Y or ^P or k or ^K" |
| 81 | Scroll backward N lines, default 1. |
| 82 | The entire N lines are displayed, even if N is more than the screen size. |
| 83 | Warning: some systems use ^Y as a special job control character. |
| 84 | .PP |
| 85 | .IP "d or ^D" |
| 86 | Scroll forward N lines, default one half of the screen size. |
| 87 | If N is specified, it becomes the new default for |
| 88 | subsequent d and u commands. |
| 89 | .PP |
| 90 | .IP "u or ^U" |
| 91 | Scroll backward N lines, default one half of the screen size. |
| 92 | If N is specified, it becomes the new default for |
| 93 | subsequent d and u commands. |
| 94 | .PP |
| 95 | .IP "r or ^R or ^L" |
| 96 | Repaint the screen. |
| 97 | .PP |
| 98 | .IP R |
| 99 | Repaint the screen, discarding any buffered input. |
| 100 | Useful if the file is changing while it is being viewed. |
| 101 | .PP |
| 102 | .IP "g or < or ESC-<" |
| 103 | Go to line N in the file, default 1 (beginning of file). |
| 104 | (Warning: this may be slow if N is large.) |
| 105 | .PP |
| 106 | .IP "G or > or ESC->" |
| 107 | Go to line N in the file, default the end of the file. |
| 108 | (Warning: this may be slow if N is large, |
| 109 | or if N is not specified and |
| 110 | standard input, rather than a file, is being read.) |
| 111 | .PP |
| 112 | .IP "p or %" |
| 113 | Go to a position N percent into the file. |
| 114 | N should be between 0 and 100. |
| 115 | (This works if standard input is being read, but only if |
| 116 | .I less |
| 117 | has already read to the end of the file. |
| 118 | It is always fast, but not always useful.) |
| 119 | .PP |
| 120 | .IP m |
| 121 | Followed by any lowercase letter, |
| 122 | marks the current position with that letter. |
| 123 | .PP |
| 124 | .IP "'" |
| 125 | (Single quote.) |
| 126 | Followed by any lowercase letter, returns to the position which |
| 127 | was previously marked with that letter. |
| 128 | Followed by another single quote, returns to the postion at |
| 129 | which the last "large" movement command was executed. |
| 130 | All marks are lost when a new file is examined. |
| 131 | .PP |
| 132 | .IP "^X^X" |
| 133 | Same as single quote. |
| 134 | .PP |
| 135 | .IP /pattern |
| 136 | Search forward in the file for the N-th line containing the pattern. |
| 137 | N defaults to 1. |
| 138 | The pattern is a regular expression, as recognized by |
| 139 | .I ed. |
| 140 | The search starts at the second line displayed |
| 141 | (but see the -a option, which changes this). |
| 142 | .PP |
| 143 | .IP ?pattern |
| 144 | Search backward in the file for the N-th line containing the pattern. |
| 145 | The search starts at the line immediately before the top line displayed. |
| 146 | .PP |
| 147 | .IP /!pattern |
| 148 | Like /, but the search is for the N-th line |
| 149 | which does NOT contain the pattern. |
| 150 | .PP |
| 151 | .IP ?!pattern |
| 152 | Like ?, but the search is for the N-th line |
| 153 | which does NOT contain the pattern. |
| 154 | .PP |
| 155 | .IP n |
| 156 | Repeat previous search, for N-th line containing the last pattern |
| 157 | (or NOT containing the last pattern, if the previous search |
| 158 | was /! or ?!). |
| 159 | .PP |
| 160 | .IP "E [filename]" |
| 161 | Examine a new file. |
| 162 | If the filename is missing, the "current" file (see the N and P commands |
| 163 | below) from the list of files in the command line is re-examined. |
| 164 | If the filename is a pound sign (#), the previously examined file is |
| 165 | re-examined. |
| 166 | .PP |
| 167 | .IP "^X^V or :e" |
| 168 | Same as E. |
| 169 | Warning: some systems use ^V as a special literalization character. |
| 170 | .PP |
| 171 | .IP "N or :n" |
| 172 | Examine the next file (from the list of files given in the command line). |
| 173 | If a number N is specified (not to be confused with the command N), |
| 174 | the N-th next file is examined. |
| 175 | .PP |
| 176 | .IP "P or :p" |
| 177 | Examine the previous file. |
| 178 | If a number N is specified, the N-th previous file is examined. |
| 179 | .PP |
| 180 | .IP "= or ^G" |
| 181 | Prints some information about the file being viewed, |
| 182 | including its name |
| 183 | and the line number and byte offset of the bottom line being displayed. |
| 184 | If possible, it also prints the length of the file |
| 185 | and the percent of the file above the last displayed line. |
| 186 | .PP |
| 187 | .IP \- |
| 188 | Followed by one of the command line option letters (see below), |
| 189 | this will change the setting of that option |
| 190 | and print a message describing the new setting. |
| 191 | If the option letter has a numeric value (such as -b or -h), |
| 192 | or a string value (such as -P or -t), |
| 193 | a new value may be entered after the option letter. |
| 194 | .PP |
| 195 | .IP \_ |
| 196 | (Underscore.) |
| 197 | Followed by one of the command line option letters (see below), |
| 198 | this will print a message describing the current setting of that option. |
| 199 | The setting of the option is not changed. |
| 200 | .PP |
| 201 | .IP +cmd |
| 202 | Causes the specified cmd to be executed each time a new file is examined. |
| 203 | For example, +G causes |
| 204 | .I less |
| 205 | to initially display each file starting at the end |
| 206 | rather than the beginning. |
| 207 | .PP |
| 208 | .IP V |
| 209 | Prints the version number of |
| 210 | .I less |
| 211 | being run. |
| 212 | .PP |
| 213 | .IP "q or :q or ZZ" |
| 214 | Exits |
| 215 | .I less. |
| 216 | .PP |
| 217 | The following |
| 218 | two |
| 219 | commands may or may not be valid, depending on your particular installation. |
| 220 | .PP |
| 221 | .IP v |
| 222 | Invokes an editor to edit the current file being viewed. |
| 223 | The editor is taken from the environment variable EDITOR, |
| 224 | or defaults to "vi". |
| 225 | .PP |
| 226 | .IP "! shell-command" |
| 227 | Invokes a shell to run the shell-command given. |
| 228 | A percent sign in the command is replaced by the name of the |
| 229 | current file. "!!" repeats the last shell command. |
| 230 | "!" with no shell command simply invokes a shell. |
| 231 | In all cases, the shell is taken from the environment variable SHELL, |
| 232 | or defaults to "sh". |
| 233 | .PP |
| 234 | .SH OPTIONS |
| 235 | Command line options are described below. |
| 236 | Most options may be changed while |
| 237 | .I less |
| 238 | is running, via the "\-" command. |
| 239 | .PP |
| 240 | Options are also taken from the environment variable "LESS". |
| 241 | For example, |
| 242 | to avoid typing "less -options ..." each time |
| 243 | .I less |
| 244 | is invoked, you might tell |
| 245 | .I csh: |
| 246 | .sp |
| 247 | setenv LESS "-options" |
| 248 | .sp |
| 249 | or if you use |
| 250 | .I sh: |
| 251 | .sp |
| 252 | LESS="-options"; export LESS |
| 253 | .sp |
| 254 | The environment variable is parsed before the command line, |
| 255 | so command line options override the LESS environment variable. |
| 256 | If an option appears in the LESS variable, it can be reset |
| 257 | to its default on the command line by beginning the command |
| 258 | line option with "-+". |
| 259 | .sp |
| 260 | A dollar sign ($) may be used to signal the end of an option string. |
| 261 | This is important only for options like -P which take a |
| 262 | following string. |
| 263 | .IP -a |
| 264 | Normally, forward searches start just after |
| 265 | the top displayed line (that is, at the second displayed line). |
| 266 | Thus, forward searches include the currently displayed screen. |
| 267 | The -a option causes forward searches to start |
| 268 | just after the bottom line displayed, |
| 269 | thus skipping the currently displayed screen. |
| 270 | .IP -A |
| 271 | The -A option causes searches to start at the second SCREEN line |
| 272 | displayed, as opposed to the default which is to start at the second |
| 273 | REAL line displayed. |
| 274 | For example, suppose a long real line occupies the first three screen lines. |
| 275 | The default search will start at the second real line (the fourth |
| 276 | screen line), while the -A option |
| 277 | will cause the search to start at the second screen line (in the |
| 278 | midst of the first real line). |
| 279 | (This option is rarely useful.) |
| 280 | .IP -b |
| 281 | The -b\fIn\fR option tells |
| 282 | .I less |
| 283 | to use a non-standard number of buffers. |
| 284 | Buffers are 1K, and normally 10 buffers are used |
| 285 | (except if data in coming from standard input; see the -B option). |
| 286 | The number \fIn\fR specifies a different number of buffers to use. |
| 287 | .IP -B |
| 288 | Normally, when data is coming from standard input, |
| 289 | buffers are allocated automatically as needed, to avoid loss of data. |
| 290 | The -B option disables this feature, so that only the default number |
| 291 | of buffers are used. |
| 292 | If more data is read than will fit in the buffers, the oldest |
| 293 | data is discarded. |
| 294 | .IP -c |
| 295 | Normally, |
| 296 | .I less |
| 297 | will repaint the screen by scrolling from the bottom of the screen. |
| 298 | If the -c option is set, when |
| 299 | .I less |
| 300 | needs to change the entire display, it will paint from the top line down. |
| 301 | .IP -C |
| 302 | The -C option is like -c, but the screen is cleared before it is repainted. |
| 303 | .IP -d |
| 304 | Normally, |
| 305 | .I less |
| 306 | will complain if the terminal is dumb; that is, lacks some important capability, |
| 307 | such as the ability to clear the screen or scroll backwards. |
| 308 | The -d option suppresses this complaint |
| 309 | (but does not otherwise change the behavior of the program on a dumb terminal). |
| 310 | .IP -e |
| 311 | Normally the only way to exit less is via the "q" command. |
| 312 | The -e option tells less to automatically exit |
| 313 | the second time it reaches end-of-file. |
| 314 | .IP -E |
| 315 | The -E flag causes less to exit the first time it reaches end-of-file. |
| 316 | .IP -h |
| 317 | Normally, |
| 318 | .I less |
| 319 | will scroll backwards when backwards movement is necessary. |
| 320 | The -h option specifies a maximum number of lines to scroll backwards. |
| 321 | If it is necessary to move backwards more than this many lines, |
| 322 | the screen is repainted in a forward direction. |
| 323 | (If the terminal does not have the ability to scroll |
| 324 | backwards, -h0 is implied.) |
| 325 | .IP -i |
| 326 | The -i option causes searches to ignore case; that is, |
| 327 | uppercase and lowercase are considered identical. |
| 328 | Also, text which is overstruck or underlined can be searched for. |
| 329 | .IP -l |
| 330 | The -l option, followed immediately by a filename, |
| 331 | will cause |
| 332 | .I less |
| 333 | to copy its input to the named file as it is being viewed. |
| 334 | This applies only when the input file is a pipe, |
| 335 | not an ordinary file. |
| 336 | If the file already exists, less will ask for confirmation before |
| 337 | overwriting it. |
| 338 | .IP -L |
| 339 | The -L option is like -l, but it will overwrite an existing |
| 340 | file without asking for confirmation. |
| 341 | .sp |
| 342 | If no log file has been specified, |
| 343 | the -l and -L options can be used from within less to specify a log file. |
| 344 | Without a file name, they will simply report the name of the log file. |
| 345 | .IP -m |
| 346 | Normally, |
| 347 | .I less |
| 348 | prompts with a colon. |
| 349 | The -m option causes |
| 350 | .I less |
| 351 | to prompt verbosely (like |
| 352 | .I more), |
| 353 | with the percent into the file. |
| 354 | .IP -M |
| 355 | The -M option causes |
| 356 | .I less |
| 357 | to prompt even more verbosely than |
| 358 | .I more. |
| 359 | .IP -n |
| 360 | The -n flag suppresses line numbers. |
| 361 | The default (to use line numbers) may cause |
| 362 | .I less |
| 363 | to run more slowly in some cases, especially with a very large input file. |
| 364 | Suppressing line numbers with the -n flag will avoid this problem. |
| 365 | Using line numbers means: the line number will be displayed in the verbose |
| 366 | prompt and in the = command, |
| 367 | and the v command will pass the current line number to the editor. |
| 368 | .IP -P |
| 369 | The -P option provides a way to tailor the three prompt |
| 370 | styles to your own preference. |
| 371 | You would normally put this option in your LESS environment |
| 372 | variable, rather than type it in with each less command. |
| 373 | Such an option must either be the last option in the LESS variable, |
| 374 | or be terminated by a dollar sign. |
| 375 | -P followed by a string changes the default (short) prompt to that string. |
| 376 | -Pm changes the medium (-m) prompt to the string, and |
| 377 | -PM changes the long (-M) prompt. |
| 378 | Also, -P= changes the message printed by the = command to the given string. |
| 379 | All prompt strings consist of a sequence of |
| 380 | letters and special escape sequences. |
| 381 | See the section on PROMPTS for more details. |
| 382 | .IP -q |
| 383 | Normally, if an attempt is made to scroll past the end of the file |
| 384 | or before the beginning of the file, the terminal bell is rung to |
| 385 | indicate this fact. |
| 386 | The -q option tells |
| 387 | .I less |
| 388 | not to ring the bell at such times. |
| 389 | If the terminal has a "visual bell", it is used instead. |
| 390 | .IP -Q |
| 391 | Even if -q is given, |
| 392 | .I less |
| 393 | will ring the bell on certain other errors, |
| 394 | such as typing an invalid character. |
| 395 | The -Q option tells |
| 396 | .I less |
| 397 | to be quiet all the time; that is, never ring the terminal bell. |
| 398 | If the terminal has a "visual bell", it is used instead. |
| 399 | .IP -s |
| 400 | The -s option causes |
| 401 | consecutive blank lines to be squeezed into a single blank line. |
| 402 | This is useful when viewing |
| 403 | .I nroff |
| 404 | output. |
| 405 | .IP -t |
| 406 | The -t option, followed immediately by a TAG, |
| 407 | will edit the file containing that tag. |
| 408 | For this to work, there must be a file called "tags" in the |
| 409 | current directory, which was previously built by the |
| 410 | .I ctags |
| 411 | (1) command. |
| 412 | This option may also be specified from within less |
| 413 | (using the \- command) as a way of examining a new file. |
| 414 | .IP -u |
| 415 | If the -u option is given, |
| 416 | backspaces are treated as printable characters; |
| 417 | that is, they are sent to the terminal when they appear in the input. |
| 418 | .IP -U |
| 419 | If the -U option is given, |
| 420 | backspaces are printed as the two character sequence "^H". |
| 421 | .sp |
| 422 | If neither -u nor -U is given, |
| 423 | backspaces which appear adjacent to an underscore character |
| 424 | are treated specially: |
| 425 | the underlined text is displayed |
| 426 | using the terminal's hardware underlining capability. |
| 427 | Also, backspaces which appear between two identical characters |
| 428 | are treated specially: |
| 429 | the overstruck text is printed |
| 430 | using the terminal's hardware boldface capability. |
| 431 | Other backspaces are deleted, along with the preceeding character. |
| 432 | .IP -w |
| 433 | Normally, |
| 434 | .I less |
| 435 | uses a tilde character to represent lines past the end of the file. |
| 436 | The -w option causes blank lines to be used instead. |
| 437 | .IP -x |
| 438 | The -x\fIn\fR option sets tab stops every \fIn\fR positions. |
| 439 | The default for \fIn\fR is 8. |
| 440 | .IP -[z] |
| 441 | When given a backwards or forwards window command, |
| 442 | .I less |
| 443 | will by |
| 444 | default scroll backwards or forwards one screenful of lines. |
| 445 | The -z\fIn\fR option changes the default scrolling window size |
| 446 | to \fIn\fR lines. |
| 447 | Note that the "z" is optional for compatibility with |
| 448 | .I more. |
| 449 | .IP + |
| 450 | If a command line option begins with \fB+\fR, |
| 451 | the remainder of that option is taken to be an initial command to |
| 452 | .I less. |
| 453 | For example, +G tells |
| 454 | .I less |
| 455 | to start at the end of the file rather than the beginning, |
| 456 | and +/xyz tells it to start at the first occurence of "xyz" in the file. |
| 457 | As a special case, +<number> acts like +<number>g; |
| 458 | that is, it starts the display at the specified line number |
| 459 | (however, see the caveat under the "g" command above). |
| 460 | If the option starts with \fB++\fR, the initial command applies to |
| 461 | every file being viewed, not just the first one. |
| 462 | The + command described previously |
| 463 | may also be used to set (or change) an initial command for every file. |
| 464 | |
| 465 | .SH "KEY BINDINGS" |
| 466 | You may define your own less commands by using the program |
| 467 | .I lesskey |
| 468 | (1) |
| 469 | to create a file called ".less" in your home directory. |
| 470 | This file specifies a set of command keys and an action |
| 471 | associated with each key. |
| 472 | See the |
| 473 | .I lesskey |
| 474 | manual page for more details. |
| 475 | |
| 476 | .SH "PROMPTS" |
| 477 | The -P option allows you to tailor the prompt to your preference. |
| 478 | The string given to the -P option replaces the specified prompt string. |
| 479 | Certain characters in the string are interpreted specially. |
| 480 | The prompt mechanism is rather complicated to provide flexibility, |
| 481 | but the ordinary user need not understand the details of constructing |
| 482 | personalized prompt strings. |
| 483 | .sp |
| 484 | A percent sign followed by a single character is expanded |
| 485 | according to what the following character is: |
| 486 | .IP "%bX" |
| 487 | Replaced by the byte offset into the current input file. |
| 488 | The b is followed by a single character (shown as X above) |
| 489 | which specifies the line whose byte offset is to be used. |
| 490 | If the character is a "t", the byte offset of the top line in the |
| 491 | display is used, |
| 492 | an "m" means use the middle line, |
| 493 | a "b" means use the bottom line, |
| 494 | and a "B" means use the line just after the bottom line. |
| 495 | .IP "%f" |
| 496 | Replaced by the name of the current input file. |
| 497 | .IP "%i" |
| 498 | Replaced by the index of the current file in the list of |
| 499 | input files. |
| 500 | .IP "%lX" |
| 501 | Replaced by the line number of a line in the input file. |
| 502 | The line to be used is determined by the X, as with the %b option. |
| 503 | .IP "%m" |
| 504 | Replaced by the total number of input files. |
| 505 | .IP "%pX" |
| 506 | Replaced by the percent into the current input file. |
| 507 | The line used is determined by the X as with the %b option. |
| 508 | .IP "%s" |
| 509 | Replaced by the size of the current input file. |
| 510 | .IP "%t" |
| 511 | Causes any trailing spaces to be removed. |
| 512 | Usually used at the end of the string, but may appear anywhere. |
| 513 | .IP "%x" |
| 514 | Replaced by the name of the next input file in the list. |
| 515 | .PP |
| 516 | If any item is unknown (for example, the file size if input |
| 517 | is a pipe), a question mark is printed instead. |
| 518 | .PP |
| 519 | The format of the prompt string can be changed |
| 520 | depending on certain conditions. |
| 521 | A question mark followed by a single character acts like an "IF": |
| 522 | depending on the following character, a condition is evaluated. |
| 523 | If the condition is true, any characters following the question mark |
| 524 | and condition character, up to a period, are included in the prompt. |
| 525 | If the condition is false, such characters are not included. |
| 526 | A colon appearing between the question mark and the |
| 527 | period can be used to establish an "ELSE": any characters between |
| 528 | the colon and the period are included in the string if and only if |
| 529 | the IF condition is false. |
| 530 | Condition characters (which follow a question mark) may be: |
| 531 | .IP "?a" |
| 532 | True if any characters have been included in the prompt so far. |
| 533 | .IP "?bX" |
| 534 | True if the byte offset of the specified line is known. |
| 535 | .IP "?e" |
| 536 | True if at end-of-file. |
| 537 | .IP "?f" |
| 538 | True if there is an input filename |
| 539 | (that is, if input is not a pipe). |
| 540 | .IP "?lX" |
| 541 | True if the line number of the specified line is known. |
| 542 | .IP "?m" |
| 543 | True if there is more than one input file. |
| 544 | .IP "?n" |
| 545 | True if this is the first prompt in a new input file. |
| 546 | .IP "?pX" |
| 547 | True if the percent into the current input file |
| 548 | of the specified line is known. |
| 549 | .IP "?s" |
| 550 | True if the size of current input file is known. |
| 551 | .IP "?x" |
| 552 | True if there is a next input file |
| 553 | (that is, if the current input file is not the last one). |
| 554 | .PP |
| 555 | Any characters other than the special ones |
| 556 | (question mark, colon, period, percent, and backslash) |
| 557 | become literally part of the prompt. |
| 558 | Any of the special characters may be included in the prompt literally |
| 559 | by preceeding it with a backslash. |
| 560 | .PP |
| 561 | Some examples: |
| 562 | .sp |
| 563 | ?f%f:Standard input. |
| 564 | .sp |
| 565 | This prompt prints the filename, if known; |
| 566 | otherwise the string "Standard input". |
| 567 | .sp |
| 568 | ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-... |
| 569 | .sp |
| 570 | This prompt would print the filename, if known. |
| 571 | The filename is followed by the line number, if known, |
| 572 | otherwise the percent if known, otherwise the byte offset if known. |
| 573 | Otherwise, a dash is printed. |
| 574 | Notice how each question mark has a matching period, |
| 575 | and how the % after the %pt |
| 576 | is included literally by escaping it with a backslash. |
| 577 | .sp |
| 578 | ?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\\:\ %x..%t |
| 579 | .sp |
| 580 | This prints the filename if this is the first prompt in a file, |
| 581 | followed by the "file N of N" message if there is more |
| 582 | than one input file. |
| 583 | Then, if we are at end-of-file, the string "(END)" is printed |
| 584 | followed by the name of the next file, if there is one. |
| 585 | Finally, any trailing spaces are truncated. |
| 586 | This is the default prompt. |
| 587 | For reference, here are the defaults for |
| 588 | the other two prompts (-m and -M respectively). |
| 589 | Each is broken into two lines here for readability only. |
| 590 | .nf |
| 591 | .sp |
| 592 | ?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\\:\ %x.: |
| 593 | ?pB%pB\\%:byte\ %bB?s/%s...%t |
| 594 | .sp |
| 595 | ?f%f\ .?n?m(file\ %i\ of\ %m)\ ..?ltline\ %lt\ :byte\ %bB?s/%s\ .. |
| 596 | ?e(END)\ ?x-\ Next\\:\ %x.:?pB%pB\\%..%t |
| 597 | .sp |
| 598 | .fi |
| 599 | And here is the default message produced by the = command: |
| 600 | .nf |
| 601 | .sp |
| 602 | ?f%f\ .?m(file\ %i\ of\ %m)\ .?ltline\ %lt\ . |
| 603 | byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\\%..%t |
| 604 | .fi |
| 605 | |
| 606 | .SH "SEE ALSO" |
| 607 | lesskey(1) |
| 608 | |
| 609 | .SH WARNINGS |
| 610 | The = command and prompts (unless changed by -P) |
| 611 | report the line number of the line at the top of the screen, |
| 612 | but the byte and percent of the line at the bottom of the screen. |