Annotation of src/usr.bin/less/less.1, Revision 1.44
1.44 ! bentley 1: .\" $OpenBSD: less.1,v 1.43 2014/05/28 14:06:20 jmc Exp $
1.1 millert 2: .\"
1.32 shadchin 3: .\" Copyright (C) 1984-2012 Mark Nudelman
1.1 millert 4: .\"
1.5 millert 5: .\" Redistribution and use in source and binary forms, with or without
6: .\" modification, are permitted provided that the following conditions
7: .\" are met:
8: .\" 1. Redistributions of source code must retain the above copyright
9: .\" notice, this list of conditions and the following disclaimer.
10: .\" 2. Redistributions in binary form must reproduce the above copyright
1.7 jmc 11: .\" notice in the documentation and/or other materials provided with
1.5 millert 12: .\" the distribution.
1.1 millert 13: .\"
1.5 millert 14: .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
15: .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.7 jmc 16: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1.5 millert 17: .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
1.7 jmc 18: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
20: .\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21: .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22: .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23: .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
1.5 millert 24: .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.1 millert 25: .\"
1.43 jmc 26: .Dd $Mdocdate: May 28 2014 $
1.1 millert 27: .Dt LESS 1
28: .Os
29: .Sh NAME
1.34 jmc 30: .Nm less
1.11 jmc 31: .Nd view files
1.1 millert 32: .Sh SYNOPSIS
1.34 jmc 33: .Nm less
34: .Op Fl #?~AaBCcdEeFfGgIiJKLMmNnQqRrSsUuVWwX
35: .Op Fl b Ar n
36: .Op Fl h Ar n
37: .Op Fl j Ar n
1.1 millert 38: .Op Fl k Ar keyfile
1.12 jmc 39: .Op Fl O | o Ar logfile
40: .Op Fl P Ar prompt
1.1 millert 41: .Op Fl p Ar pattern
1.12 jmc 42: .Op Fl T Ar tagsfile
1.1 millert 43: .Op Fl t Ar tag
1.34 jmc 44: .Op Fl x Ar n Ns , Ns Ar ...
45: .Op Fl y Ar n
1.44 ! bentley 46: .Op Fl z Ar n
1.34 jmc 47: .Op Ar
1.1 millert 48: .Sh DESCRIPTION
49: .Nm
50: is a program similar to the traditional
51: .Xr more 1 ,
1.37 jmc 52: but with many more features.
53: It displays text one screenful at a time.
54: After showing each screenful, it prompts the user for a command.
55: When showing the last line of a file,
56: .Nm
57: displays a prompt indicating end of file and the name of the next file
58: to examine, if any.
59: It then waits for input from the user.
1.1 millert 60: .Pp
1.38 jmc 61: Commands are based on both traditional
62: .Xr more 1
63: and
64: .Xr vi 1 .
65: Commands may be preceded by a decimal number,
1.44 ! bentley 66: called
! 67: .Ar N
! 68: in the descriptions below.
1.38 jmc 69: The number is used by some commands, as indicated.
70: .Pp
1.1 millert 71: This version of
72: .Nm
73: also acts as
74: .Xr more 1
75: if it is called as
1.37 jmc 76: .Nm more ,
77: or if the
78: .Ev LESS_IS_MORE
79: environment variable is set.
80: The main differences between the two are summarized in the
81: .Sx COMPATIBILITY WITH MORE
82: section, below.
83: .Pp
1.1 millert 84: A long option name may be abbreviated as long as the abbreviation is
85: unambiguous.
86: Such option names need only have their first letter capitalized;
87: the remainder of the name may be in either case.
1.44 ! bentley 88: For example,
! 89: .Fl -Quit-at-eof
! 90: is equivalent to
! 91: .Fl -QUIT-AT-EOF .
1.1 millert 92: .Pp
1.36 jmc 93: The options are as follows:
1.1 millert 94: .Bl -tag -width XXXX
1.6 jmc 95: .It Fl \&? | -help
1.1 millert 96: This option displays a summary of the commands accepted by
97: .Nm
1.44 ! bentley 98: (the same as the
! 99: .Ic h
! 100: command).
1.1 millert 101: (Depending on how your shell interprets the question mark,
1.44 ! bentley 102: it may be necessary to quote the question mark, thus:
! 103: .Ql Fl Ns \e? . )
1.23 shadchin 104: .It Fl A | -SEARCH-SKIP-SCREEN
105: Causes all forward searches (not just non-repeated searches)
106: to start just after the target line, and all backward searches
107: to start just before the target line.
108: Thus, forward searches will skip part of the displayed screen
109: (from the first line up to and including the target line).
110: Similarly backwards searches will skip the displayed screen
111: from the last line up to and including the target line.
1.44 ! bentley 112: This was the default behavior in
! 113: .Nm
! 114: versions prior to 441.
1.1 millert 115: .It Fl a | -search-skip-screen
1.23 shadchin 116: By default, forward searches start at the top of the displayed screen
117: and backwards searches start at the bottom of the displayed screen
1.44 ! bentley 118: (except for repeated searches invoked by the
! 119: .Ic n
! 120: or
! 121: .Ic N
! 122: commands,
! 123: which start after or before the
! 124: .Dq target
! 125: line respectively; see the
! 126: .Fl j
! 127: option for more about the target line).
! 128: The
! 129: .Fl a
! 130: option causes forward searches to instead start at the bottom of the screen
1.23 shadchin 131: and backward searches to start at the top of the screen,
1.1 millert 132: thus skipping all lines displayed on the screen.
1.12 jmc 133: .It Fl B | -auto-buffers
134: By default, when data is read from a pipe,
135: buffers are allocated automatically as needed.
136: If a large amount of data is read from the pipe, this can cause
137: a large amount of memory to be allocated.
1.44 ! bentley 138: The
! 139: .Fl B
! 140: option disables this automatic allocation of buffers for pipes,
! 141: so that only 64K (or the amount of space specified by the
! 142: .Fl b
! 143: option) is used for the pipe.
! 144: .Sy Warning :
! 145: use of
! 146: .Fl B
! 147: can result in erroneous display, since only the
1.23 shadchin 148: most recently viewed part of the piped data is kept in memory;
1.12 jmc 149: any earlier data is lost.
1.44 ! bentley 150: .It Fl b Ar n | Fl -buffers Ns = Ns Ar n
1.1 millert 151: Specifies the amount of buffer space
152: .Nm
153: will use for each file, in units of kilobytes (1024 bytes).
154: By default 64K of buffer space is used for each file
1.44 ! bentley 155: (unless the file is a pipe; see the
! 156: .Fl B
! 157: option).
! 158: The
! 159: .Fl b
! 160: option specifies instead that
! 161: .Ar n
! 162: kilobytes of buffer space should be used for each file.
! 163: If
! 164: .Ar n
! 165: is -1, buffer space is unlimited; that is,
1.23 shadchin 166: the entire file can be read into memory.
1.12 jmc 167: .It Fl C | -CLEAR-SCREEN
1.44 ! bentley 168: Same as
! 169: .Fl c ,
! 170: for compatibility with older versions of
! 171: .Nm .
1.1 millert 172: .It Fl c | -clear-screen
1.27 jmc 173: Causes full screen repaints to be painted from the bottom of the screen.
174: By default, full screen repaints are done from the top line down
175: to avoid the position of the display being moved
1.26 nicm 176: when using interactive commands.
1.33 millert 177: .It Fl d | -dumb
1.44 ! bentley 178: The
! 179: .Fl d
! 180: option suppresses the error message normally displayed if the terminal is dumb;
! 181: that is, if the terminal lacks some important capability,
1.1 millert 182: such as the ability to clear the screen or scroll backward.
1.44 ! bentley 183: The
! 184: .Fl d
! 185: option does not otherwise change the behavior of
1.1 millert 186: .Nm
187: on a dumb terminal.
1.12 jmc 188: .It Fl E | -QUIT-AT-EOF
189: Causes
190: .Nm
191: to automatically exit the first time it reaches end-of-file.
1.1 millert 192: .It Fl e | -quit-at-eof
193: Causes
194: .Nm
195: to automatically exit the second time it reaches end-of-file.
196: By default, the only way to exit
197: .Nm
1.44 ! bentley 198: is via the
! 199: .Ic q
! 200: command.
1.12 jmc 201: .It Fl F | -quit-if-one-screen
1.1 millert 202: Causes
203: .Nm
1.12 jmc 204: to automatically exit if the entire file can be displayed on the first screen.
1.1 millert 205: .It Fl f | -force
206: Forces non-regular files to be opened.
207: (A non-regular file is a directory or a device special file.)
208: Also suppresses the warning message when a binary file is opened.
209: By default,
210: .Nm
211: will refuse to open non-regular files.
1.12 jmc 212: .It Fl G | -HILITE-SEARCH
1.44 ! bentley 213: The
! 214: .Fl G
! 215: option suppresses all highlighting of strings found by search commands.
1.1 millert 216: .It Fl g | -hilite-search
217: Normally,
218: .Nm
1.44 ! bentley 219: will highlight all strings which match the last search command.
! 220: The
! 221: .Fl g
! 222: option changes this behavior to highlight only the particular string
1.1 millert 223: which was found by the last search command.
224: This can cause
225: .Nm
226: to run somewhat faster than the default.
1.44 ! bentley 227: .It Fl h Ar n | Fl -max-back-scroll Ns = Ns Ar n
1.1 millert 228: Specifies a maximum number of lines to scroll backward.
229: If it is necessary to scroll backward more than n lines,
230: the screen is repainted in a forward direction instead.
1.44 ! bentley 231: (If the terminal does not have the ability to scroll backward,
! 232: .Sq Fl h Ns 0
! 233: is implied.)
1.12 jmc 234: .It Fl I | -IGNORE-CASE
1.44 ! bentley 235: Like
! 236: .Fl i ,
! 237: but searches ignore case even if the pattern contains uppercase
1.12 jmc 238: letters.
1.1 millert 239: .It Fl i | -ignore-case
240: Causes searches to ignore case; that is,
241: uppercase and lowercase are considered identical.
242: This option is ignored if any uppercase letters appear in the search pattern;
243: in other words,
244: if a pattern contains uppercase letters, then that search does not ignore case.
1.12 jmc 245: .It Fl J | -status-column
246: Displays a status column at the left edge of the screen.
247: The status column shows the lines that matched the current search.
1.44 ! bentley 248: The status column is also used if the
! 249: .Fl w
! 250: or
! 251: .Fl W
! 252: option is in effect.
! 253: .It Fl j Ar n | Fl -jump-target Ns = Ns Ar n
! 254: Specifies a line on the screen where the
! 255: .Dq target
! 256: line is to be positioned.
1.23 shadchin 257: The target line is the line specified by any command to
258: search for a pattern, jump to a line number,
259: jump to a file percentage or jump to a tag.
260: The screen line may be specified by a number: the top line on the screen
1.1 millert 261: is 1, the next is 2, and so on.
262: The number may be negative to specify a line relative to the bottom
263: of the screen: the bottom line on the screen is -1, the second
264: to the bottom is -2, and so on.
1.23 shadchin 265: Alternately, the screen line may be specified as a fraction of the height
266: of the screen, starting with a decimal point: .5 is in the middle of the
267: screen, .3 is three tenths down from the first line, and so on.
268: If the line is specified as a fraction, the actual line number
269: is recalculated if the terminal window is resized, so that the
270: target line remains at the specified fraction of the screen height.
1.44 ! bentley 271: If any form of the
! 272: .Fl j
! 273: option is used,
1.23 shadchin 274: forward searches begin at the line immediately after the target line,
275: and backward searches begin at the target line,
1.44 ! bentley 276: unless changed by
! 277: .Fl a
! 278: or
! 279: .Fl A .
! 280: For example, if
! 281: .Sq Fl j Ns 4
! 282: is used, the target line is the fourth line on the screen,
! 283: so forward searches begin at the fifth line on the screen.
1.23 shadchin 284: .It Fl K | -quit-on-intr
285: Causes
286: .Nm
1.44 ! bentley 287: to exit immediately (with status 2) when an interrupt character (usually
! 288: .Ic ^C )
! 289: is typed.
1.23 shadchin 290: Normally, an interrupt character causes
291: .Nm
292: to stop whatever it is doing and return to its command prompt.
1.24 jmc 293: Note that use of this option makes it impossible to return to the
1.44 ! bentley 294: command prompt from the
! 295: .Ic F
! 296: command.
! 297: .It Fl k Ar keyfile | Fl -lesskey-file Ns = Ns Ar keyfile
1.1 millert 298: Causes
299: .Nm
300: to open and interpret the named file as a
301: .Xr lesskey 1
302: file.
1.44 ! bentley 303: Multiple
! 304: .Fl k
! 305: options may be specified.
1.36 jmc 306: If the
307: .Ev LESSKEY
308: or
309: .Ev LESSKEY_SYSTEM
310: environment variable is set, or if a lesskey file is found in a standard place
311: (see
312: .Sx KEY BINDINGS ) ,
313: it is also used as a lesskey file.
314: .It Fl L | -no-lessopen
315: Ignore the
316: .Ev LESSOPEN
317: environment variable (see the
318: .Sx INPUT PREPROCESSOR
319: section below).
320: This option can be set from within
321: .Nm less ,
322: but it will apply only to files opened subsequently, not to the
323: file which is currently open.
324: .It Fl M | -LONG-PROMPT
325: Causes
326: .Nm
327: to prompt even more verbosely than
1.39 jmc 328: .Xr more 1 .
1.36 jmc 329: .It Fl m | -long-prompt
330: Causes
331: .Nm
1.39 jmc 332: to prompt verbosely, like
333: .Xr more 1 ,
334: with the percent into the file.
1.36 jmc 335: By default,
336: .Nm
337: prompts with a colon.
338: .It Fl N | -LINE-NUMBERS
339: Causes a line number to be displayed at the beginning of each line in the
340: display.
341: .It Fl n | -line-numbers
342: Suppresses line numbers.
343: The default (to use line numbers) may cause
344: .Nm
345: to run more slowly in some cases, especially with a very large input file.
1.44 ! bentley 346: Suppressing line numbers with the
! 347: .Fl n
! 348: option will avoid this problem.
1.36 jmc 349: Using line numbers means: the line number will be displayed in the verbose
1.44 ! bentley 350: prompt and in the
! 351: .Ic =
! 352: command, and the
! 353: .Ic v
! 354: command will pass the current line
! 355: number to the editor (see also the discussion of
! 356: .Ev LESSEDIT
! 357: in
1.36 jmc 358: .Sx PROMPTS
359: below).
1.44 ! bentley 360: .It Fl O Ar logfile | Fl -LOG-FILE Ns = Ns Ar logfile
! 361: The
! 362: .Fl O
! 363: option is like
! 364: .Fl o ,
! 365: but it will overwrite an existing file without asking for confirmation.
1.36 jmc 366: .Pp
367: If no log file has been specified,
1.44 ! bentley 368: the
! 369: .Fl o
! 370: and
! 371: .Fl O
! 372: options can be used from within
1.36 jmc 373: .Nm
374: to specify a log file.
375: Without a file name, they will simply report the name of the log file.
1.44 ! bentley 376: The
! 377: .Ic s
! 378: command is equivalent to specifying
! 379: .Fl o
! 380: from within
! 381: .Nm .
! 382: .It Fl o Ar logfile | Fl -log-file Ns = Ns Ar logfile
1.36 jmc 383: Causes
384: .Nm
385: to copy its input to the named file as it is being viewed.
386: This applies only when the input file is a pipe, not an ordinary file.
387: If the file already exists,
388: .Nm
389: will ask for confirmation before overwriting it.
1.44 ! bentley 390: .It Fl P Ar prompt | Fl -prompt Ns = Ns Ar prompt
1.36 jmc 391: Provides a way to tailor the three prompt styles to your own preference.
392: This option would normally be put in the
393: .Ev LESS
394: environment variable, rather than being typed in with each
395: .Nm
396: command.
397: Such an option must either be the last option in the
398: .Ev LESS
399: variable, or be terminated by a dollar sign.
1.44 ! bentley 400: .Bl -item
! 401: .It
! 402: .Fl Ps Ar string
! 403: changes the default (short) prompt to
! 404: .Ar string .
! 405: .It
! 406: .Fl Pm
! 407: changes the medium
! 408: .Pq Fl m
! 409: prompt.
! 410: .It
! 411: .Fl PM
! 412: changes the long
! 413: .Pq Fl M
! 414: prompt.
! 415: .It
! 416: .Fl Ph
! 417: changes the prompt for the help screen.
! 418: .It
! 419: .Fl P=
! 420: changes the message printed by the
! 421: .Ic =
! 422: command.
! 423: .It
! 424: .Fl Pw
! 425: changes the message printed while waiting for data (in the
! 426: .Ic F
! 427: command).
! 428: .El
1.36 jmc 429: All prompt strings consist of a sequence of letters and special escape
430: sequences.
431: See the section on
432: .Sx PROMPTS
433: for more details.
1.44 ! bentley 434: .It Fl p Ar pattern | Fl -pattern Ns = Ns Ar pattern
! 435: The
! 436: .Fl p
! 437: option on the command line is equivalent to specifying
! 438: .Cm +/ Ns Ar pattern ;
1.36 jmc 439: that is, it tells
440: .Nm
441: to start at the first occurrence of pattern in the file.
442: .It Fl Q | -QUIET | -SILENT
1.44 ! bentley 443: Causes totally quiet operation: the terminal bell is never rung.
1.36 jmc 444: .It Fl q | -quiet | -silent
1.44 ! bentley 445: Causes moderately quiet operation:
1.36 jmc 446: the terminal bell is not rung if an attempt is made to scroll past the end
447: of the file or before the beginning of the file.
1.44 ! bentley 448: If the terminal has a visual bell, it is used instead.
1.36 jmc 449: The bell will be rung on certain other errors,
450: such as typing an invalid character.
451: The default is to ring the terminal bell in all such cases.
452: .It Fl R | -RAW-CONTROL-CHARS
1.44 ! bentley 453: Like
! 454: .Fl r ,
! 455: but only ANSI color escape sequences are output in raw form.
! 456: Unlike
! 457: .Fl r ,
! 458: the screen appearance is maintained correctly in most cases.
! 459: ANSI color escape sequences are sequences of the form:
1.36 jmc 460: .Pp
461: .Dl ESC \&[ ... m
462: .Pp
1.44 ! bentley 463: where the
! 464: .Dq ...
! 465: is zero or more color specification characters.
1.36 jmc 466: For the purpose of keeping track of screen appearance,
467: ANSI color escape sequences are assumed to not move the cursor.
468: You can make
469: .Nm
1.44 ! bentley 470: think that characters other than
! 471: .Sq m
! 472: can end ANSI color escape sequences by setting the environment variable
1.36 jmc 473: .Ev LESSANSIENDCHARS
474: to the list of characters which can end a color escape sequence.
475: And you can make
476: .Nm
477: think that characters other than the standard ones may appear between
1.44 ! bentley 478: the
! 479: .Cm ESC
! 480: and the
! 481: .Cm m
! 482: by setting the environment variable
1.36 jmc 483: .Ev LESSANSIMIDCHARS
484: to the list of characters which can appear.
485: .It Fl r | -raw-control-chars
1.44 ! bentley 486: Causes raw control characters to be displayed.
1.36 jmc 487: The default is to display control characters using the caret notation;
1.44 ! bentley 488: for example, a control-A (octal 001) is displayed as
! 489: .Sq ^A .
! 490: .Sy Warning :
! 491: when the
! 492: .Fl r
! 493: option is used,
1.36 jmc 494: .Nm
495: cannot keep track of the actual appearance of the screen
496: (since this depends on how the screen responds to
497: each type of control character).
498: Thus, various display problems may result,
499: such as long lines being split in the wrong place.
500: .It Fl S | -chop-long-lines
501: Causes lines longer than the screen width to be
502: chopped (truncated) rather than wrapped.
503: That is, the portion of a long line that does not fit in
504: the screen width is not shown.
505: The default is to wrap long lines; that is, display the remainder
506: on the next line.
507: .It Fl s | -squeeze-blank-lines
508: Causes consecutive blank lines to be squeezed into a single blank line.
1.44 ! bentley 509: .It Fl T Ar tagsfile | Fl -tag-file Ns = Ns Ar tagsfile
! 510: Specifies a tags file to be used instead of
! 511: .Pa tags .
1.36 jmc 512: .It Xo
513: .Fl t Ar tag |
514: .Fl -tag Ns = Ns Ar tag
515: .Xc
1.44 ! bentley 516: The
! 517: .Fl t
! 518: option, followed immediately by a
! 519: .Ar tag ,
1.36 jmc 520: will edit the file containing that tag.
521: For this to work, tag information must be available;
1.44 ! bentley 522: for example, there may be a file in the current directory called
! 523: .Pa tags ,
1.36 jmc 524: which was previously built by
525: .Xr ctags 1
526: or an equivalent command.
527: If the environment variable
528: .Ev LESSGLOBALTAGS
529: is set, it is taken to be the name of a command compatible with
1.44 ! bentley 530: .Em global ,
1.36 jmc 531: and that command is executed to find the tag.
532: (See
1.44 ! bentley 533: .Lk https://www.gnu.org/software/global/global.html . )
! 534: The
! 535: .Fl t
! 536: option may also be specified from within
1.36 jmc 537: .Nm
1.44 ! bentley 538: (using the
! 539: .Ic -
! 540: command) as a way of examining a new file.
! 541: The command
! 542: .Ic :t
! 543: is equivalent to specifying
! 544: .Fl t
! 545: from within
! 546: .Nm .
1.36 jmc 547: .It Fl U | -UNDERLINE-SPECIAL
548: Causes backspaces, tabs and carriage returns to be
549: treated as control characters;
1.44 ! bentley 550: that is, they are handled as specified by the
! 551: .Fl r
! 552: option.
1.36 jmc 553: .Pp
1.44 ! bentley 554: By default, if neither
! 555: .Fl u
! 556: nor
! 557: .Fl U
! 558: is given, backspaces which appear adjacent
1.36 jmc 559: to an underscore character are treated specially:
560: the underlined text is displayed
561: using the terminal's hardware underlining capability.
562: Also, backspaces which appear between two identical characters
563: are treated specially:
564: the overstruck text is printed
565: using the terminal's hardware boldface capability.
566: Other backspaces are deleted, along with the preceding character.
567: Carriage returns immediately followed by a newline are deleted.
1.44 ! bentley 568: Other carriage returns are handled as specified by the
! 569: .Fl r
! 570: option.
1.36 jmc 571: Text which is overstruck or underlined can be searched for
1.44 ! bentley 572: if neither
! 573: .Fl u
! 574: nor
! 575: .Fl U
! 576: is in effect.
1.36 jmc 577: .It Fl u | -underline-special
578: Causes backspaces and carriage returns to be treated as printable characters;
579: that is, they are sent to the terminal when they appear in the input.
580: .It Fl V | -version
581: Displays the version number of
1.44 ! bentley 582: .Nm .
1.36 jmc 583: .It Fl W | -HILITE-UNREAD
1.44 ! bentley 584: Like
! 585: .Fl w ,
! 586: but temporarily highlights the first new line after any
1.36 jmc 587: forward movement command larger than one line.
588: .It Fl w | -hilite-unread
1.44 ! bentley 589: Temporarily highlights the first new line after a forward movement
1.36 jmc 590: of a full page.
1.44 ! bentley 591: The first new line is the line immediately following the line previously
1.36 jmc 592: at the bottom of the screen.
1.44 ! bentley 593: Also highlights the target line after a
! 594: .Ic g
! 595: or
! 596: .Ic p
! 597: command.
1.36 jmc 598: The highlight is removed at the next command which causes movement.
1.44 ! bentley 599: The entire line is highlighted, unless the
! 600: .Fl J
! 601: option is in effect,
1.36 jmc 602: in which case only the status column is highlighted.
603: .It Fl X | -no-init
604: Disables sending the termcap initialization and deinitialization strings
605: to the terminal.
606: This is sometimes desirable if the deinitialization string does
607: something unnecessary, like clearing the screen.
608: .It Xo
1.44 ! bentley 609: .Fl x Ar n , Ns Ar ... |
! 610: .Fl -tabs Ns = Ns Ar n , Ns Ar ...
1.36 jmc 611: .Xc
612: Sets tab stops.
1.44 ! bentley 613: If only one
! 614: .Ar n
! 615: is specified, tab stops are set at multiples of
! 616: .Ar n .
1.36 jmc 617: If multiple values separated by commas are specified, tab stops are set at
618: those positions, and then continue with the same spacing as the last two.
1.44 ! bentley 619: For example,
! 620: .Sq Fl x Ns 9,17
! 621: will set tabs at positions 9, 17, 25, 33, etc.
! 622: The default for
! 623: .Ar n
! 624: is 8.
! 625: .It Fl y Ar n | Fl -max-forw-scroll Ns = Ns Ar n
1.36 jmc 626: Specifies a maximum number of lines to scroll forward.
627: If it is necessary to scroll forward more than n lines,
628: the screen is repainted instead.
1.44 ! bentley 629: The
! 630: .Fl c
! 631: or
! 632: .Fl C
! 633: option may be used to repaint from the top of the screen if desired.
1.36 jmc 634: By default, any forward movement causes scrolling.
1.44 ! bentley 635: .It Fl z Ar n | Fl -window Ns = Ns Ar n
! 636: Changes the default scrolling window size to
! 637: .Ar n
! 638: lines.
1.36 jmc 639: The default is one screenful.
1.44 ! bentley 640: The
! 641: .Ic z
! 642: and
! 643: .Ic w
! 644: commands can also be used to change the window size.
! 645: The
! 646: .Cm z
! 647: may be omitted for compatibility with some versions of
1.39 jmc 648: .Xr more 1 .
1.36 jmc 649: If the number
650: .Ar n
651: is negative, it indicates
652: .Ar n
653: lines less than the current screen size.
1.44 ! bentley 654: For example, if the screen is 24 lines,
! 655: .Fl z Ns -4
! 656: sets the scrolling window to 20 lines.
1.36 jmc 657: If the screen is resized to 40 lines,
658: the scrolling window automatically changes to 36 lines.
659: .It Fl -follow-name
1.44 ! bentley 660: Normally, if the input file is renamed while an
! 661: .Ic F
! 662: command is executing,
1.1 millert 663: .Nm
1.36 jmc 664: will continue to display the contents of the original file despite
665: its name change.
1.44 ! bentley 666: If
! 667: .Fl -follow-name
! 668: is specified, during an
! 669: .Ic F
! 670: command
1.1 millert 671: .Nm
1.36 jmc 672: will periodically attempt to reopen the file by name.
673: If the reopen succeeds and the file is a different file from the original
674: (which means that a new file has been created
675: with the same name as the original (now renamed) file),
1.1 millert 676: .Nm
1.36 jmc 677: will display the contents of that new file.
678: .It Fl -no-keypad
679: Disables sending the keypad initialization and deinitialization strings
680: to the terminal.
681: This is sometimes useful if the keypad strings make the numeric
682: keypad behave in an undesirable manner.
683: .It Fl -use-backslash
684: This option changes the interpretations of options which follow this one.
1.44 ! bentley 685: After the
! 686: .Fl -use-backslash
! 687: option, any backslash in an option string is
1.36 jmc 688: removed and the following character is taken literally.
689: This allows a dollar sign to be included in option strings.
1.44 ! bentley 690: .It Fl \&" Ar cc | Fl -quotes Ns = Ns Ar cc
1.36 jmc 691: Changes the filename quoting character.
692: This may be necessary if you are trying to name a file
693: which contains both spaces and quote characters.
1.44 ! bentley 694: If
! 695: .Ar cc
! 696: is a single character, this changes the quote character to that character.
1.36 jmc 697: Filenames containing a space should then be surrounded by that character
698: rather than by double quotes.
1.44 ! bentley 699: If
! 700: .Ar cc
! 701: consists of two characters, this changes the open quote to the first character,
1.36 jmc 702: and the close quote to the second character.
703: Filenames containing a space should then be preceded by the open quote
704: character and followed by the close quote character.
705: Note that even after the quote characters are changed, this option
1.44 ! bentley 706: remains
! 707: .Fl \&"
! 708: (a dash followed by a double quote).
1.36 jmc 709: .It Fl ~ | -tilde
710: Normally lines after end of file are displayed as a single tilde (~).
711: This option causes lines after end of file to be displayed as blank lines.
712: .It Fl # | -shift
713: Specifies the default number of positions to scroll horizontally
714: in the RIGHTARROW and LEFTARROW commands.
715: If the number specified is zero, it sets the default number of
716: positions to one half of the screen width.
717: Alternately, the number may be specified as a fraction of the width
718: of the screen, starting with a decimal point: .5 is half of the
719: screen width, .3 is three tenths of the screen width, and so on.
720: If the number is specified as a fraction, the actual number of
721: scroll positions is recalculated if the terminal window is resized,
722: so that the actual scroll remains at the specified fraction
723: of the screen width.
724: .It Fl -
1.44 ! bentley 725: A command line argument of
! 726: .Fl -
! 727: marks the end of option arguments.
1.36 jmc 728: Any arguments following this are interpreted as filenames.
1.44 ! bentley 729: This can be useful when viewing a file whose name begins with a
! 730: .Sq -
! 731: or
! 732: .Sq + .
1.36 jmc 733: .It Cm +
734: If a command line option begins with +,
735: the remainder of that option is taken to be an initial command to
1.44 ! bentley 736: .Nm .
! 737: For example,
! 738: .Cm +G
! 739: tells
1.36 jmc 740: .Nm
741: to start at the end of the file rather than the beginning,
1.44 ! bentley 742: and
! 743: .Cm +/xyz
! 744: tells it to start at the first occurrence of
! 745: .Dq xyz
! 746: in the file.
! 747: As a special case,
! 748: .Cm + Ns Ar number
! 749: acts like
! 750: .Cm + Ns Ar number Ns g ;
1.36 jmc 751: that is, it starts the display at the specified line number
1.44 ! bentley 752: (however, see the caveat under the
! 753: .Ic g
! 754: command below).
! 755: If the option starts with
! 756: .Cm ++ ,
! 757: the initial command applies to every file being viewed, not just the first one.
! 758: The
! 759: .Cm +
! 760: command described previously
1.36 jmc 761: may also be used to set (or change) an initial command for every file.
762: .El
763: .Sh COMMANDS
764: In the following descriptions, ^X means control-X.
765: ESC stands for the ESCAPE key; for example ESC-v means the
766: two character sequence "ESCAPE", then "v".
767: .Bl -tag -width XXXX
768: .It Ic h | H
769: Help: display a summary of these commands.
770: If you forget all the other commands, remember this one.
771: .It Ic SPACE | ^V | f | ^F
1.44 ! bentley 772: Scroll forward N lines, default one window (see option
! 773: .Fl z
! 774: above).
1.36 jmc 775: If N is more than the screen size, only the final screenful is displayed.
776: Warning: some systems use ^V as a special literalization character.
777: .It Ic z
778: Like SPACE, but if N is specified, it becomes the new window size.
779: .It Ic ESC-SPACE
780: Like SPACE, but scrolls a full screenful, even if it reaches
781: end-of-file in the process.
782: .It Ic ENTER | RETURN | ^N | e | ^E | j | ^J
783: Scroll forward N lines, default 1.
784: The entire N lines are displayed, even if N is more than the screen size.
785: .It Ic d | ^D
786: Scroll forward N lines, default one half of the screen size.
787: If N is specified, it becomes the new default for subsequent d and u commands.
788: .It Ic b | ^B | ESC-v
1.44 ! bentley 789: Scroll backward N lines, default one window (see option
! 790: .Fl z
! 791: above).
1.36 jmc 792: If N is more than the screen size, only the final screenful is displayed.
793: .It Ic w
794: Like ESC-v, but if N is specified, it becomes the new window size.
795: .It Ic y | ^Y | ^P | k | ^K
796: Scroll backward N lines, default 1.
797: The entire N lines are displayed, even if N is more than the screen size.
798: Warning: some systems use ^Y as a special job control character.
799: .It Ic u | ^U
800: Scroll backward N lines, default one half of the screen size.
801: If N is specified, it becomes the new default for subsequent d and u commands.
802: .It Ic ESC-) | RIGHTARROW
803: Scroll horizontally right N characters, default half the screen width
1.44 ! bentley 804: (see the
! 805: .Fl #
! 806: option).
1.36 jmc 807: If a number N is specified, it becomes the default for future
808: RIGHTARROW and LEFTARROW commands.
1.44 ! bentley 809: While the text is scrolled, it acts as though the
! 810: .Fl S
! 811: option (chop lines) were in effect.
1.36 jmc 812: .It Ic ESC-( | LEFTARROW
813: Scroll horizontally left N
1.44 ! bentley 814: characters, default half the screen width (see the
! 815: .Fl #
! 816: option).
1.36 jmc 817: If a number N is specified, it becomes the default for future
818: RIGHTARROW and LEFTARROW commands.
819: .It Ic r | ^R | ^L
820: Repaint the screen.
821: .It Ic R
822: Repaint the screen, discarding any buffered input.
823: Useful if the file is changing while it is being viewed.
824: .It Ic F
825: Scroll forward, and keep trying to read when the end of file is reached.
826: Normally this command would be used when already at the end of the file.
827: It is a way to monitor the tail of a file which is growing
828: while it is being viewed.
829: (The behavior is similar to the "tail -f" command.)
830: .It Ic ESC-F
831: Like F, but as soon as a line is found which matches
832: the last search pattern, the terminal bell is rung
833: and forward scrolling stops.
834: .It Ic g | < | ESC-<
835: Go to line N in the file, default 1 (beginning of file).
836: (Warning: this may be slow if N is large.)
837: .It Ic G | > | ESC->
838: Go to line N in the file, default the end of the file.
839: (Warning: this may be slow if N is large,
840: or if N is not specified and standard input, rather than a file,
841: is being read.)
842: .It Ic p | %
843: Go to a position N percent into the file.
844: N should be between 0 and 100, and may contain a decimal point.
845: .It Ic P
846: Go to the line containing byte offset N in the file.
847: .It Ic {
848: If a left curly bracket appears in the top line displayed
849: on the screen, the { command will go to the matching right curly bracket.
850: The matching right curly bracket is positioned on the bottom
851: line of the screen.
852: If there is more than one left curly bracket on the top line, a number N
853: may be used to specify the N-th bracket on the line.
854: .It Ic }
855: If a right curly bracket appears in the bottom line displayed on the screen,
856: the } command will go to the matching left curly bracket.
857: The matching left curly bracket is positioned on the top
858: line of the screen.
859: If there is more than one right curly bracket on the top line,
860: a number N may be used to specify the N-th bracket on the line.
861: .It Ic \&(
862: Like {, but applies to parentheses rather than curly brackets.
863: .It Ic \&)
864: Like }, but applies to parentheses rather than curly brackets.
865: .It Ic \&[
866: Like {, but applies to square brackets rather than curly brackets.
867: .It Ic \&]
868: Like }, but applies to square brackets rather than curly brackets.
869: .It Ic ESC-^F
870: Followed by two characters, acts like {,
871: but uses the two characters as open and close brackets, respectively.
872: For example, "ESC ^F < >" could be used to
873: go forward to the > which matches the < in the top displayed line.
874: .It Ic ESC-^B
875: Followed by two characters, acts like },
876: but uses the two characters as open and close brackets, respectively.
877: For example, "ESC ^B < >" could be used to
878: go backward to the < which matches the > in the bottom displayed line.
879: .It Ic m
880: Followed by any lowercase letter, marks the current position with that letter.
881: .It Ic '
882: (Single quote.)
883: Followed by any lowercase letter, returns to the position which
884: was previously marked with that letter.
885: Followed by another single quote, returns to the position at
886: which the last "large" movement command was executed.
887: Followed by a ^ or $, jumps to the beginning or end of the file respectively.
888: Marks are preserved when a new file is examined,
889: so the ' command can be used to switch between input files.
890: .It Ic ^X^X
891: Same as single quote.
892: .It Ic /pattern
893: Search forward in the file for the N-th line containing the pattern.
894: N defaults to 1.
895: The pattern is a regular expression, as recognized by
896: the regular expression library supplied by your system.
897: The search starts at the first line displayed
1.44 ! bentley 898: (but see the
! 899: .Fl a
! 900: and
! 901: .Fl j
! 902: options, which change this).
1.1 millert 903: .Pp
1.36 jmc 904: Certain characters are special if entered at the beginning of the pattern;
905: they modify the type of search rather than become part of the pattern:
906: .Bl -tag -width Ds
907: .It Ic ^N | \&!
908: Search for lines which do NOT match the pattern.
909: .It Ic ^E | *
910: Search multiple files.
911: That is, if the search reaches the END of the current file
912: without finding a match,
913: the search continues in the next file in the command line list.
914: .It Ic ^F | @
915: Begin the search at the first line of the FIRST file
916: in the command line list,
917: regardless of what is currently displayed on the screen
1.44 ! bentley 918: or the settings of the
! 919: .Fl a
! 920: or
! 921: .Fl j
! 922: options.
1.36 jmc 923: .It Ic ^K
924: Highlight any text which matches the pattern on the current screen,
925: but don't move to the first match (KEEP current position).
926: .It Ic ^R
927: Don't interpret regular expression metacharacters;
928: that is, do a simple textual comparison.
929: .El
930: .It Ic ?pattern
931: Search backward in the file for the N-th line containing the pattern.
932: The search starts at the line immediately before the top line displayed.
1.1 millert 933: .Pp
1.36 jmc 934: Certain characters are special, as in the / command:
935: .Bl -tag -width Ds
936: .It Ic ^N | \&!
937: Search for lines which do NOT match the pattern.
938: .It Ic ^E | *
939: Search multiple files.
940: That is, if the search reaches the beginning of the current file
941: without finding a match,
942: the search continues in the previous file in the command line list.
943: .It Ic ^F | @
944: Begin the search at the last line of the last file
945: in the command line list,
946: regardless of what is currently displayed on the screen
1.44 ! bentley 947: or the settings of the
! 948: .Fl a
! 949: or
! 950: .Fl j
! 951: options.
1.36 jmc 952: .It Ic ^K
953: As in forward searches.
954: .It Ic ^R
955: As in forward searches.
956: .El
957: .It Ic ESC-/pattern
958: Same as "/*".
959: .It Ic ESC-?pattern
960: Same as "?*".
961: .It Ic n
962: Repeat previous search, for N-th line containing the last pattern.
963: If the previous search was modified by ^N, the search is made for the
964: N-th line NOT containing the pattern.
965: If the previous search was modified by ^E, the search continues
966: in the next (or previous) file if not satisfied in the current file.
967: If the previous search was modified by ^R, the search is done
968: without using regular expressions.
969: There is no effect if the previous search was modified by ^F or ^K.
970: .It Ic N
971: Repeat previous search, but in the reverse direction.
972: .It Ic ESC-n
973: Repeat previous search, but crossing file boundaries.
974: The effect is as if the previous search were modified by *.
975: .It Ic ESC-N
976: Repeat previous search, but in the reverse direction
977: and crossing file boundaries.
978: .It Ic ESC-u
979: Undo search highlighting.
980: Turn off highlighting of strings matching the current search pattern.
981: If highlighting is already off because of a previous ESC-u command,
982: turn highlighting back on.
983: Any search command will also turn highlighting back on.
1.44 ! bentley 984: (Highlighting can also be disabled by toggling the
! 985: .Fl G
! 986: option;
1.36 jmc 987: in that case search commands do not turn highlighting back on.)
988: .It Ic &pattern
989: Display only lines which match the pattern;
990: lines which do not match the pattern are not displayed.
991: If pattern is empty (if you type & immediately followed by ENTER),
992: any filtering is turned off, and all lines are displayed.
993: While filtering is in effect, an ampersand is displayed at the
994: beginning of the prompt,
995: as a reminder that some lines in the file may be hidden.
1.1 millert 996: .Pp
1.36 jmc 997: Certain characters are special as in the / command:
998: .Bl -tag -width Ds
999: .It Ic ^N | !
1000: Display only lines which do NOT match the pattern.
1001: .It Ic ^R
1002: Don't interpret regular expression metacharacters;
1003: that is, do a simple textual comparison.
1004: .El
1005: .It Ic :e Op Ar filename
1006: Examine a new file.
1007: If the filename is missing, the "current" file (see the :n and :p commands
1008: below) from the list of files in the command line is re-examined.
1009: A percent sign (%) in the filename is replaced by the name of the
1010: current file.
1011: A pound sign (#) is replaced by the name of the previously examined file.
1012: However, two consecutive percent signs are simply
1013: replaced with a single percent sign.
1014: This allows you to enter a filename that contains a percent sign
1015: in the name.
1016: Similarly, two consecutive pound signs are replaced with a single pound sign.
1017: The filename is inserted into the command line list of files
1018: so that it can be seen by subsequent :n and :p commands.
1019: If the filename consists of several files, they are all inserted into
1020: the list of files and the first one is examined.
1021: If the filename contains one or more spaces,
1022: the entire filename should be enclosed in double quotes
1.44 ! bentley 1023: (also see the
! 1024: .Fl \&"
! 1025: option).
1.36 jmc 1026: .It Ic ^X^V | E
1027: Same as :e.
1028: Warning: some systems use ^V as a special literalization character.
1029: On such systems, you may not be able to use ^V.
1030: .It Ic :n
1031: Examine the next file (from the list of files given in the command line).
1032: If a number N is specified, the N-th next file is examined.
1033: .It Ic :p
1034: Examine the previous file in the command line list.
1035: If a number N is specified, the N-th previous file is examined.
1036: .It Ic :t
1037: Go to the specified tag.
1038: .It Ic :x
1039: Examine the first file in the command line list.
1040: If a number N is specified, the N-th file in the list is examined.
1041: .It Ic :d
1042: Remove the current file from the list of files.
1043: .It Ic t
1044: Go to the next tag, if there were more than one matches for the current tag.
1.44 ! bentley 1045: See the
! 1046: .Fl t
! 1047: option for more details about tags.
1.36 jmc 1048: .It Ic T
1049: Go to the previous tag, if there were more than one matches for the current tag.
1050: .It Ic = | ^G | :f
1051: Prints some information about the file being viewed, including its name
1052: and the line number and byte offset of the bottom line being displayed.
1053: If possible, it also prints the length of the file,
1054: the number of lines in the file
1055: and the percent of the file above the last displayed line.
1056: .It Ic \-
1057: Followed by one of the command line option letters (see
1.44 ! bentley 1058: .Sx DESCRIPTION
! 1059: above),
1.36 jmc 1060: this will change the setting of that option
1061: and print a message describing the new setting.
1062: If a ^P (CONTROL-P) is entered immediately after the dash,
1063: the setting of the option is changed but no message is printed.
1.44 ! bentley 1064: If the option letter has a numeric value (such as
! 1065: .Fl b
! 1066: or
! 1067: .Fl h ) ,
! 1068: or a string value (such as
! 1069: .Fl P
! 1070: or
! 1071: .Fl t ) ,
1.36 jmc 1072: a new value may be entered after the option letter.
1073: If no new value is entered, a message describing
1074: the current setting is printed and nothing is changed.
1075: .It Ic \-\-
1076: Like the \- command, but takes a long option name (see
1.44 ! bentley 1077: .Sx DESCRIPTION
! 1078: above)
1.36 jmc 1079: rather than a single option letter.
1080: You must press ENTER or RETURN after typing the option name.
1081: A ^P immediately after the second dash suppresses printing of a
1082: message describing the new setting, as in the \- command.
1083: .It Ic \-+
1084: Followed by one of the command line option letters this will reset the
1085: option to its default setting and print a message describing the new setting.
1.44 ! bentley 1086: (The "\-+X" command does the same thing as
! 1087: .Sq Fl + Ns X
! 1088: on the command line.)
1.36 jmc 1089: This does not work for string-valued options.
1090: .It Ic \-\-+
1091: Like the \-+ command, but takes a long option name
1092: rather than a single option letter.
1093: .It Ic \-!
1094: Followed by one of the command line option letters, this will reset the
1095: option to the "opposite" of its default setting and print a message
1096: describing the new setting.
1097: This does not work for numeric or string-valued options.
1098: .It Ic \-\-!
1099: Like the \-! command, but takes a long option name
1100: rather than a single option letter.
1101: .It Ic _
1102: (Underscore.)
1103: Followed by one of the command line option letters,
1104: this will print a message describing the current setting of that option.
1105: The setting of the option is not changed.
1106: .It Ic __
1107: (Double underscore.)
1108: Like the _ (underscore) command, but takes a long option name
1109: rather than a single option letter.
1110: You must press ENTER or RETURN after typing the option name.
1111: .It Ic +cmd
1112: Causes the specified cmd to be executed each time a new file is examined.
1113: For example, +G causes
1.23 shadchin 1114: .Nm
1.36 jmc 1115: to initially display each file starting at the end rather than the beginning.
1116: .It Ic V
1117: Prints the version number of
1.12 jmc 1118: .Nm
1.36 jmc 1119: being run.
1120: .It Ic q | Q | :q | :Q | ZZ
1121: Exits
1.1 millert 1122: .Nm less .
1.36 jmc 1123: .El
1.1 millert 1124: .Pp
1.36 jmc 1125: The following
1126: four
1127: commands may or may not be valid, depending on your particular installation.
1128: .Bl -tag -width XXXX
1129: .It Ic v
1130: Invokes an editor to edit the current file being viewed.
1131: The editor is taken from the environment variable
1132: .Ev VISUAL ,
1133: if defined,
1134: or
1135: .Ev EDITOR
1136: if
1137: .Ev VISUAL
1138: is not defined,
1139: or defaults to "vi" if neither
1140: .Ev VISUAL
1141: nor
1142: .Ev EDITOR
1143: is defined.
1144: See also the discussion of LESSEDIT under the section on
1145: .Sx PROMPTS
1146: below.
1147: .It Ic \&! Ar shell-command
1148: Invokes a shell to run the shell-command given.
1149: A percent sign (%) in the command is replaced by the name of the current file.
1150: A pound sign (#) is replaced by the name of the previously examined file.
1151: "!!" repeats the last shell command.
1152: "!" with no shell command simply invokes a shell.
1153: The shell is taken from the environment variable
1154: .Ev SHELL ,
1155: or defaults to "sh".
1156: .It Ic | <m> Ar shell-command
1157: <m> represents any mark letter.
1158: Pipes a section of the input file to the given shell command.
1159: The section of the file to be piped is between the first line on
1160: the current screen and the position marked by the letter.
1161: <m> may also be ^ or $ to indicate beginning or end of file respectively.
1162: If <m> is . or newline, the current screen is piped.
1163: .It Ic s Ar filename
1164: Save the input to a file.
1165: This only works if the input is a pipe, not an ordinary file.
1.1 millert 1166: .El
1167: .Sh LINE EDITING
1168: When entering command line at the bottom of the screen
1169: (for example, a filename for the :e command,
1170: or the pattern for a search command),
1171: certain keys can be used to manipulate the command line.
1172: Most commands have an alternate form in [ brackets ] which can be used if
1173: a key does not exist on a particular keyboard.
1174: Any of these special keys may be entered literally by preceding
1175: it with the "literal" character, either ^V or ^A.
1176: A backslash itself may also be entered literally by entering two backslashes.
1177: .Bl -tag -width Ds
1178: .It LEFTARROW [ ESC-h ]
1179: Move the cursor one space to the left.
1180: .It RIGHTARROW [ ESC-l ]
1181: Move the cursor one space to the right.
1182: .It ^LEFTARROW [ ESC-b or ESC-LEFTARROW ]
1183: (That is, CONTROL and LEFTARROW simultaneously.)
1184: Move the cursor one word to the left.
1185: .It ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]
1186: (That is, CONTROL and RIGHTARROW simultaneously.)
1187: Move the cursor one word to the right.
1188: .It HOME [ ESC-0 ]
1189: Move the cursor to the beginning of the line.
1190: .It END [ ESC-$ ]
1191: Move the cursor to the end of the line.
1192: .It BACKSPACE
1193: Delete the character to the left of the cursor,
1194: or cancel the command if the command line is empty.
1195: .It DELETE or [ ESC-x ]
1196: Delete the character under the cursor.
1197: .It ^BACKSPACE [ ESC-BACKSPACE ]
1198: (That is, CONTROL and BACKSPACE simultaneously.)
1199: Delete the word to the left of the cursor.
1200: .It ^DELETE [ ESC-X or ESC-DELETE ]
1201: (That is, CONTROL and DELETE simultaneously.)
1202: Delete the word under the cursor.
1203: .It UPARROW [ ESC-k ]
1204: Retrieve the previous command line.
1.32 shadchin 1205: If you first enter some text and then press UPARROW,
1206: it will retrieve the previous command which begins with that text.
1.1 millert 1207: .It DOWNARROW [ ESC-j ]
1208: Retrieve the next command line.
1.32 shadchin 1209: If you first enter some text and then press DOWNARROW,
1210: it will retrieve the next command which begins with that text.
1.1 millert 1211: .It TAB
1212: Complete the partial filename to the left of the cursor.
1213: If it matches more than one filename, the first match
1214: is entered into the command line.
1215: Repeated TABs will cycle through the other matching filenames.
1216: If the completed filename is a directory, a "/" is appended to the filename.
1217: The environment variable
1218: .Ev LESSSEPARATOR
1219: can be used to specify a different character to append to a directory name.
1220: .It BACKTAB [ ESC-TAB ]
1221: Like TAB, but cycles in the reverse direction through the matching filenames.
1222: .It ^L
1223: Complete the partial filename to the left of the cursor.
1224: If it matches more than one filename, all matches are entered into
1225: the command line (if they fit).
1226: .It ^U
1227: Delete the entire command line,
1228: or cancel the command if the command line is empty.
1229: If you have changed your line-kill character to something
1230: other than ^U, that character is used instead of ^U.
1.23 shadchin 1231: .It "^G"
1232: Delete the entire command line and return to the main prompt.
1.1 millert 1233: .El
1234: .Sh KEY BINDINGS
1235: You may define your own
1236: .Nm
1237: commands by using the program
1238: .Xr lesskey 1
1239: to create a lesskey file.
1240: This file specifies a set of command keys and an action
1241: associated with each key.
1242: You may also use lesskey
1243: to change the line-editing keys (see
1244: .Sx LINE EDITING ) ,
1245: and to set environment variables.
1246: If the environment variable
1247: .Ev LESSKEY
1248: is set,
1249: .Nm
1250: uses that as the name of the lesskey file.
1251: Otherwise,
1252: .Nm
1253: looks for a lesskey file called "$HOME/.less".
1254: See the
1255: .Xr lesskey 1
1256: manual page for more details.
1257: .Pp
1258: A system-wide lesskey file may also be set up to provide key bindings.
1259: If a key is defined in both a local lesskey file and in the
1260: system-wide file, key bindings in the local file take precedence over
1261: those in the system-wide file.
1262: If the environment variable
1263: .Ev LESSKEY_SYSTEM
1264: is set,
1265: .Nm
1266: uses that as the name of the system-wide lesskey file.
1267: Otherwise,
1268: .Nm
1269: looks in a standard place for the system-wide lesskey file:
1270: On
1271: .Ox ,
1272: the system-wide lesskey file is
1273: .Pa /etc/sysless .
1274: .Sh INPUT PREPROCESSOR
1275: You may define an "input preprocessor" for
1276: .Nm less .
1277: Before
1278: .Nm less
1279: opens a file, it first gives your input preprocessor a chance to modify the
1280: way the contents of the file are displayed.
1281: An input preprocessor is simply an executable program (or shell script),
1282: which writes the contents of the file to a different file,
1283: called the replacement file.
1284: The contents of the replacement file are then displayed
1285: in place of the contents of the original file.
1286: However, it will appear to the user as if the original file is opened;
1287: that is,
1288: .Nm less
1289: will display the original filename as the name of the current file.
1290: .Pp
1291: An input preprocessor receives one command line argument, the original filename,
1292: as entered by the user.
1293: It should create the replacement file, and when finished
1294: print the name of the replacement file to its standard output.
1295: If the input preprocessor does not output a replacement filename,
1296: .Nm
1297: uses the original file, as normal.
1298: The input preprocessor is not called when viewing standard input.
1299: To set up an input preprocessor, set the
1300: .Ev LESSOPEN
1301: environment variable to a command line which will invoke your
1302: input preprocessor.
1303: This command line should include one occurrence of the string "%s",
1304: which will be replaced by the filename
1305: when the input preprocessor command is invoked.
1306: .Pp
1307: When
1308: .Nm
1309: closes a file opened in such a way, it will call another program,
1310: called the input postprocessor,
1311: which may perform any desired clean-up action (such as deleting the
1312: replacement file created by
1313: .Ev LESSOPEN ) .
1314: This program receives two command line arguments, the original filename
1315: as entered by the user, and the name of the replacement file.
1316: To set up an input postprocessor, set the
1317: .Ev LESSCLOSE
1318: environment variable to a command line which will invoke your
1319: input postprocessor.
1320: It may include two occurrences of the string "%s";
1321: the first is replaced with the original name of the file and the second
1322: with the name of the replacement file, which was output by
1323: .Ev LESSOPEN .
1324: .Pp
1325: For example, these two scripts will allow you
1326: to keep files in compressed format, but still let
1327: .Nm
1328: view them directly:
1329: .Pp
1330: lessopen.sh:
1331: .Bd -literal -offset indent
1332: #! /bin/sh
1333: case "$1" in
1334: *.Z) uncompress -c $1 >/tmp/less.$$ 2>/dev/null
1335: if [ -s /tmp/less.$$ ]; then
1336: echo /tmp/less.$$
1337: else
1338: rm -f /tmp/less.$$
1339: fi
1340: ;;
1341: esac
1342: .Ed
1343: .Pp
1344: lessclose.sh:
1345: .Bd -literal -offset indent
1346: #! /bin/sh
1347: rm $2
1348: .Ed
1349: .Pp
1350: To use these scripts, put them both where they can be executed and
1351: set LESSOPEN="lessopen.sh\ %s", and LESSCLOSE="lessclose.sh\ %s\ %s".
1352: More complex LESSOPEN and LESSCLOSE scripts may be written
1353: to accept other types of compressed files, and so on.
1354: .Pp
1355: It is also possible to set up an input preprocessor to
1356: pipe the file data directly to
1357: .Nm less ,
1358: rather than putting the data into a replacement file.
1359: This avoids the need to decompress the entire file before starting to view it.
1360: An input preprocessor that works this way is called an input pipe.
1361: An input pipe, instead of writing the name of a replacement file on
1362: its standard output,
1363: writes the entire contents of the replacement file on its standard output.
1364: If the input pipe does not write any characters on its standard output,
1365: then there is no replacement file and
1366: .Nm
1367: uses the original file, as normal.
1368: To use an input pipe, make the first character in the
1369: .Ev LESSOPEN
1370: environment variable a vertical bar (|) to signify that the
1371: input preprocessor is an input pipe.
1372: .Pp
1373: For example, this script will work like the previous example scripts:
1374: .Pp
1375: lesspipe.sh:
1376: .Bd -literal -offset indent
1377: #! /bin/sh
1378: case "$1" in
1379: *.Z) uncompress -c $1 2>/dev/null
1.32 shadchin 1380: *) exit 1
1.1 millert 1381: ;;
1382: esac
1.32 shadchin 1383: exit $?
1.1 millert 1384: .Ed
1385: .Pp
1386: To use this script, put it where it can be executed and set
1387: LESSOPEN="|lesspipe.sh %s".
1.32 shadchin 1388: .Pp
1389: Note that a preprocessor cannot output an empty file, since that
1390: is interpreted as meaning there is no replacement, and
1391: the original file is used.
1392: To avoid this, if
1393: .Ev LESSOPEN
1394: starts with two vertical bars,
1395: the exit status of the script becomes meaningful.
1396: If the exit status is zero, the output is considered to be
1397: replacement text, even if it empty.
1398: If the exit status is nonzero, any output is ignored and the
1399: original file is used.
1400: For compatibility with previous versions of
1401: .Nm less ,
1402: if
1403: .Ev LESSOPEN
1404: starts with only one vertical bar, the exit status
1405: of the preprocessor is ignored.
1406: .Pp
1.1 millert 1407: When an input pipe is used, a LESSCLOSE postprocessor can be used,
1408: but it is usually not necessary since there is no replacement file to clean up.
1409: In this case, the replacement file name passed to the LESSCLOSE
1410: postprocessor is "-".
1.23 shadchin 1411: .Pp
1412: For compatibility with previous versions of
1413: .Nm less ,
1414: the input preprocessor or pipe is not used if
1415: .Nm
1416: is viewing standard input.
1417: However, if the first character of LESSOPEN is a dash (-),
1418: the input preprocessor is used on standard input as well as other files.
1419: In this case, the dash is not considered to be part of
1420: the preprocessor command.
1421: If standard input is being viewed, the input preprocessor is passed
1422: a file name consisting of a single dash.
1423: Similarly, if the first two characters of LESSOPEN are vertical bar and dash
1.32 shadchin 1424: (|-) or two vertical bars and a dash (||-),
1425: the input pipe is used on standard input as well as other files.
1.23 shadchin 1426: Again, in this case the dash is not considered to be part of
1427: the input pipe command.
1.1 millert 1428: .Sh NATIONAL CHARACTER SETS
1429: There are three types of characters in the input file:
1430: .Bl -tag -width "control characters"
1431: .It normal characters
1432: Can be displayed directly to the screen.
1433: .It control characters
1434: Should not be displayed directly, but are expected to be found
1435: in ordinary text files (such as backspace and tab).
1436: .It binary characters
1437: Should not be displayed directly and are not expected to be found
1438: in text files.
1439: .El
1440: .Pp
1441: A "character set" is simply a description of which characters are to
1442: be considered normal, control, and binary.
1443: The
1444: .Ev LESSCHARSET
1445: environment variable may be used to select a character set.
1446: Possible values for
1447: .Ev LESSCHARSET
1448: are:
1449: .Bl -tag -width "IBM-1047"
1450: .It ascii
1451: BS, TAB, NL, CR, and formfeed are control characters,
1452: all chars with values between 32 and 126 are normal,
1453: and all others are binary.
1454: .It iso8859
1455: Selects an ISO 8859 character set.
1456: This is the same as ASCII, except characters between 160 and 255 are
1457: treated as normal characters.
1458: .It latin1
1459: Same as iso8859.
1460: .It latin9
1461: Same as iso8859.
1462: .It dos
1463: Selects a character set appropriate for MS-DOS.
1464: .It ebcdic
1465: Selects an EBCDIC character set.
1466: .It IBM-1047
1.17 sobrado 1467: Selects an EBCDIC character set used by OS/390
1468: .Ux
1469: Services.
1.1 millert 1470: This is the EBCDIC analogue of latin1.
1471: You get similar results by setting either LESSCHARSET=IBM-1047 or
1472: LC_CTYPE=en_US in your environment.
1473: .It koi8-r
1474: Selects a Russian character set.
1475: .It next
1476: Selects a character set appropriate for NeXT computers.
1477: .It utf-8
1478: Selects the UTF-8 encoding of the ISO 10646 character set.
1.23 shadchin 1479: UTF-8 is special in that it supports multi-byte characters in the input file.
1480: It is the only character set that supports multi-byte characters.
1481: .It windows
1482: Selects a character set appropriate for Microsoft Windows (cp 1251).
1.1 millert 1483: .El
1484: .Pp
1.23 shadchin 1485: In rare cases, it may be desired to tailor
1.1 millert 1486: .Nm
1487: to use a character set other than the ones definable by LESSCHARSET.
1488: In this case, the environment variable
1489: .Ev LESSCHARDEF
1490: can be used to define a character set.
1491: It should be set to a string where each character in the string represents
1492: one character in the character set.
1493: The character "." is used for a normal character, "c" for control,
1494: and "b" for binary.
1495: A decimal number may be used for repetition.
1496: For example, "bccc4b." would mean character 0 is binary,
1497: 1, 2 and 3 are control, 4, 5, 6 and 7 are binary, and 8 is normal.
1498: All characters after the last are taken to be the same as the last,
1499: so characters 9 through 255 would be normal.
1500: (This is an example, and does not necessarily
1501: represent any real character set.)
1502: .Pp
1503: This table shows the value of LESSCHARDEF which is equivalent
1504: to each of the possible values for LESSCHARSET:
1505: .Bd -literal -offset indent
1506: ascii 8bcccbcc18b95.b
1507: dos 8bcccbcc12bc5b95.b.
1508: ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
1509: 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
1510: IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
1511: 191.b
1512: iso8859 8bcccbcc18b95.33b.
1513: koi8-r 8bcccbcc18b95.b128.
1514: latin1 8bcccbcc18b95.33b.
1515: next 8bcccbcc18b95.bb125.bb
1516: .Ed
1517: .Pp
1518: If neither LESSCHARSET nor LESSCHARDEF is set,
1.23 shadchin 1519: but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" is found in the
1.21 jmc 1520: .Ev LC_ALL , LC_CTYPE
1.1 millert 1521: or
1522: .Ev LANG
1523: environment variables, then the default character set is utf-8.
1524: .Pp
1525: If that string is not found, but your system supports the
1526: setlocale interface,
1527: .Nm
1528: will use setlocale to determine the character set.
1529: setlocale is controlled by setting the
1530: .Ev LANG
1531: or
1532: .Ev LC_CTYPE
1533: environment variables.
1534: .Pp
1535: Finally, if the
1536: setlocale interface is also not available, the default character set is latin1.
1537: .Pp
1538: Control and binary characters are displayed in standout (reverse video).
1539: Each such character is displayed in caret notation if possible
1540: (e.g. ^A for control-A).
1541: Caret notation is used only if inverting the 0100 bit results in a
1542: normal printable character.
1543: Otherwise, the character is displayed as a hex number in angle brackets.
1544: This format can be changed by setting the
1545: .Ev LESSBINFMT
1546: environment variable.
1547: LESSBINFMT may begin with a "*" and one character to select
1548: the display attribute:
1549: "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout,
1550: and "*n" is normal.
1551: If LESSBINFMT does not begin with a "*", normal attribute is assumed.
1552: The remainder of LESSBINFMT is a string which may include one
1553: printf-style escape sequence (a % followed by x, X, o, d, etc.).
1554: For example, if LESSBINFMT is "*u[%x]", binary characters
1555: are displayed in underlined hexadecimal surrounded by brackets.
1.23 shadchin 1556: The default if no LESSBINFMT is specified is "*s<%02X>".
1557: Warning: the result of expanding the character via LESSBINFMT must
1558: be less than 31 characters.
1559: .Pp
1560: When the character set is utf-8, the
1561: .Ev LESSUTFBINFMT
1562: environment variable
1563: acts similarly to LESSBINFMT but it applies to Unicode code points
1564: that were successfully decoded but are unsuitable for display (e.g.,
1565: unassigned code points).
1566: Its default value is "<U+%04lX>".
1567: Note that LESSUTFBINFMT and LESSBINFMT share their display attribute
1568: setting ("*x") so specifying one will affect both;
1569: LESSUTFBINFMT is read after LESSBINFMT so its setting, if any,
1570: will have priority.
1571: Problematic octets in a UTF-8 file (octets of a truncated sequence,
1572: octets of a complete but non-shortest form sequence, illegal octets,
1573: and stray trailing octets)
1574: are displayed individually using LESSBINFMT so as to facilitate diagnostic
1575: of how the UTF-8 file is ill-formed.
1.1 millert 1576: .Sh PROMPTS
1.44 ! bentley 1577: The
! 1578: .Fl P
! 1579: option allows you to tailor the prompt to your preference.
! 1580: The string given to the
! 1581: .Fl P
! 1582: option replaces the specified prompt string.
1.1 millert 1583: Certain characters in the string are interpreted specially.
1584: The prompt mechanism is rather complicated to provide flexibility,
1585: but the ordinary user need not understand the details of constructing
1586: personalized prompt strings.
1587: .Pp
1588: A percent sign followed by a single character is expanded
1589: according to what the following character is:
1590: .Bl -tag -width Ds
1591: .It %b Ns Ar X
1592: Replaced by the byte offset into the current input file.
1593: The b is followed by a single character (shown as
1594: .Ar X
1595: above) which specifies the line whose byte offset is to be used.
1596: If the character is a "t", the byte offset of the top line in the
1597: display is used,
1598: an "m" means use the middle line,
1599: a "b" means use the bottom line,
1600: a "B" means use the line just after the bottom line,
1.44 ! bentley 1601: and a "j" means use the "target" line, as specified by the
! 1602: .Fl j
! 1603: option.
1.4 jmc 1604: .It \&%B
1.1 millert 1605: Replaced by the size of the current input file.
1606: .It %c
1607: Replaced by the column number of the text appearing in the first
1608: column of the screen.
1609: .It %d Ns Ar X
1610: Replaced by the page number of a line in the input file.
1611: The line to be used is determined by the
1612: .Ar X ,
1613: as with the %b option.
1.4 jmc 1614: .It \&%D
1.1 millert 1615: Replaced by the number of pages in the input file,
1616: or equivalently, the page number of the last line in the input file.
1617: .It %E
1618: Replaced by the name of the editor (from the
1619: .Ev VISUAL
1620: environment variable, or the
1621: .Ev EDITOR
1622: environment variable if
1623: .Ev VISUAL
1624: is not defined).
1625: See the discussion of the LESSEDIT feature below.
1626: .It %f
1627: Replaced by the name of the current input file.
1.23 shadchin 1628: .It %F
1629: Replaced by the last component of the name of the current input file.
1.1 millert 1630: .It %i
1631: Replaced by the index of the current file in the list of
1632: input files.
1633: .It %l Ns Ar X
1634: Replaced by the line number of a line in the input file.
1635: The line to be used is determined by the
1636: .Ar X ,
1637: as with the %b option.
1638: .It %L
1639: Replaced by the line number of the last line in the input file.
1640: .It %m
1641: Replaced by the total number of input files.
1642: .It %p Ns Ar X
1643: Replaced by the percent into the current input file, based on byte offsets.
1644: The line used is determined by the
1645: .Ar X ,
1646: as with the %b option.
1.4 jmc 1647: .It \&%P Ns Ar X
1.1 millert 1648: Replaced by the percent into the current input file, based on line numbers.
1649: The line used is determined by the
1650: .Ar X ,
1651: as with the %b option.
1652: .It %s
1653: Same as %B.
1654: .It %t
1655: Causes any trailing spaces to be removed.
1656: Usually used at the end of the string, but may appear anywhere.
1657: .It %x
1658: Replaced by the name of the next input file in the list.
1659: .El
1660: .Pp
1661: If any item is unknown (for example, the file size if input is a pipe),
1662: a question mark is printed instead.
1663: .Pp
1664: The format of the prompt string can be changed depending on certain conditions.
1665: A question mark followed by a single character acts like an "IF":
1666: depending on the following character, a condition is evaluated.
1667: If the condition is true, any characters following the question mark
1668: and condition character, up to a period, are included in the prompt.
1669: If the condition is false, such characters are not included.
1670: A colon appearing between the question mark and the
1671: period can be used to establish an "ELSE": any characters between
1672: the colon and the period are included in the string, if and only if
1673: the IF condition is false.
1674: Condition characters (which follow a question mark) may be:
1675: .Bl -tag -width Ds
1676: .It ?a
1677: True if any characters have been included in the prompt so far.
1678: .It ?b Ns Ar X
1679: True if the byte offset of the specified line is known.
1680: .It ?B
1681: True if the size of the current input file is known.
1682: .It ?c
1683: True if the text is horizontally shifted (%c is not zero).
1684: .It ?d Ns Ar X
1685: True if the page number of the specified line is known.
1686: .It ?e
1687: True if at end-of-file.
1688: .It ?f
1689: True if there is an input filename
1690: (that is, if input is not a pipe).
1691: .It ?l Ns Ar X
1692: True if the line number of the specified line is known.
1693: .It ?L
1694: True if the line number of the last line in the file is known.
1695: .It ?m
1696: True if there is more than one input file.
1697: .It ?n
1698: True if this is the first prompt in a new input file.
1699: .It ?p Ns Ar X
1700: True if the percent into the current input file, based on byte offsets,
1701: of the specified line is known.
1702: .It ?P Ns Ar X
1703: True if the percent into the current input file, based on line numbers,
1704: of the specified line is known.
1705: .It ?s
1706: Same as "?B".
1707: .It ?x
1708: True if there is a next input file
1709: (that is, if the current input file is not the last one).
1710: .El
1711: .Pp
1712: Any characters other than the special ones
1713: (question mark, colon, period, percent, and backslash)
1714: become literally part of the prompt.
1715: Any of the special characters may be included in the prompt literally
1716: by preceding it with a backslash.
1717: .Pp
1718: Some examples:
1719: .Pp
1720: .Dl ?f%f:Standard input.
1721: .Pp
1722: This prompt prints the filename, if known;
1723: otherwise the string "Standard input".
1724: .Pp
1725: .Dl ?f%f .?ltLine %lt:?pt%pt\e%:?btByte %bt:-...
1726: .Pp
1727: This prompt would print the filename, if known.
1728: The filename is followed by the line number, if known,
1729: otherwise the percent if known, otherwise the byte offset if known.
1730: Otherwise, a dash is printed.
1731: Notice how each question mark has a matching period,
1732: and how the % after the %pt
1733: is included literally by escaping it with a backslash.
1734: .Pp
1735: .Dl ?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\e:\ %x..%t
1736: .Pp
1737: This prints the filename if this is the first prompt in a file,
1738: followed by the "file N of N" message if there is more
1739: than one input file.
1740: Then, if we are at end-of-file, the string "(END)" is printed
1741: followed by the name of the next file, if there is one.
1742: Finally, any trailing spaces are truncated.
1743: This is the default prompt.
1744: For reference, here are the defaults for
1.44 ! bentley 1745: the other two prompts
! 1746: .Po
! 1747: .Fl m
! 1748: and
! 1749: .Fl M
! 1750: respectively
! 1751: .Pc .
1.1 millert 1752: Each is broken into two lines here for readability only.
1753: .Bd -literal -offset indent
1.19 ray 1754: ?f%f\ .?m(file\ %i\ of\ %m)\ .?e(END)\ ?x-\ Next\e:\ %x.:
1.1 millert 1755: ?pB%pB\e%:byte\ %bB?s/%s...%t
1756:
1757: ?f%f\ .?n?m(file\ %i\ of\ %m)\ ..?ltlines\ %lt-%lb?L/%L.\ :
1758: byte\ %bB?s/%s.\ .?e(END)\ ?x-\ Next\e:\ %x.:?pB%pB\e%..%t
1759: .Ed
1760: .Pp
1761: And here is the default message produced by the = command:
1762: .Bd -literal -offset indent
1763: ?f%f\ .?m(file\ %i\ of\ %m)\ .?ltlines\ %lt-%lb?L/%L.\ .
1764: byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\e%..%t
1765: .Ed
1766: .Pp
1767: The prompt expansion features are also used for another purpose:
1768: if an environment variable
1769: .Ev LESSEDIT
1770: is defined, it is used as the command to be executed when the v command
1771: is invoked.
1772: The LESSEDIT string is expanded in the same way as the prompt strings.
1773: The default value for LESSEDIT is:
1774: .Pp
1775: .Dl %E\ ?lm+%lm.\ %f
1776: .Pp
1777: Note that this expands to the editor name, followed by a + and the
1778: line number, followed by the file name.
1779: If your editor does not accept the "+linenumber" syntax, or has other
1780: differences in invocation syntax, the
1781: .Ev LESSEDIT
1782: variable can be changed to modify this default.
1783: .Sh SECURITY
1784: When the environment variable
1785: .Ev LESSSECURE
1786: is set to 1,
1787: .Nm
1788: runs in a "secure" mode.
1789: This means these features are disabled:
1790: .Bl -tag -width Ds
1.6 jmc 1791: .It \&!
1.1 millert 1792: The shell command.
1793: .It |
1794: The pipe command.
1795: .It :e
1796: The examine command.
1797: .It v
1798: The editing command.
1799: .It s -o
1800: Log files.
1.44 ! bentley 1801: .It Fl k
1.1 millert 1802: Use of lesskey files.
1.44 ! bentley 1803: .It Fl t
1.1 millert 1804: Use of tags files.
1805: .It " "
1806: Metacharacters in filenames, such as "*".
1807: .It " "
1808: Filename completion (TAB, ^L).
1809: .El
1810: .Pp
1811: Less can also be compiled to be permanently in "secure" mode.
1.23 shadchin 1812: .Sh COMPATIBILITY WITH MORE
1813: If the environment variable
1814: .Ev LESS_IS_MORE
1815: is set to 1,
1816: or if the program is invoked via a file link named "more",
1817: .Nm
1818: behaves (mostly) in conformance with the POSIX "more" command specification.
1819: In this mode, less behaves differently in these ways:
1820: .Pp
1.43 jmc 1821: The sense of the
1822: .Fl c
1823: option is inverted:
1824: when
1825: .Xr more 1
1826: changes the display,
1827: the default is to scroll from the bottom of the screen,
1828: and the
1829: .Fl c
1830: option causes it to paint from the top line down.
1831: .Pp
1.37 jmc 1832: The
1833: .Fl e
1834: option works differently:
1835: it causes
1836: .Xr more 1
1837: to exit the first time it reaches EOF,
1838: not the second.
1.42 millert 1839: .Pp
1840: The
1841: .Fl i
1842: option acts like the
1843: .Fl I
1844: option.
1845: The normal behavior of the
1846: .Fl i
1847: option is unavailable in this mode.
1.23 shadchin 1848: .Pp
1.37 jmc 1849: The
1850: .Fl m
1851: option works differently:
1852: if it is not specified, the medium prompt is used;
1853: if it is specified, the short prompt is used.
1.23 shadchin 1854: .Pp
1.37 jmc 1855: The
1856: .Fl n
1857: option acts like the
1858: .Fl z
1859: option.
1860: The normal behavior of the
1861: .Fl n
1862: option is unavailable in this mode.
1863: .Pp
1864: The parameter to the
1865: .Fl p
1866: option is taken to be a
1.23 shadchin 1867: command rather than a search pattern.
1868: .Pp
1.43 jmc 1869: Options to suppress error messages when the terminal is dumb
1870: .Pq Fl d ,
1871: suppress highlighting of strings in search results
1872: .Pq Fl G ,
1873: and disable termcap initialization
1874: .Pq Fl X
1875: are on by default.
1876: .Pp
1.23 shadchin 1877: The
1878: .Ev LESS
1.39 jmc 1879: environment variables are ignored, and the
1.23 shadchin 1880: .Ev MORE
1881: environment variable is used in its place.
1.3 jmc 1882: .Sh ENVIRONMENT
1.1 millert 1883: Environment variables may be specified either in the system environment
1884: as usual, or in a
1885: .Xr lesskey 1
1886: file.
1887: If environment variables are defined in more than one place,
1888: variables defined in a local lesskey file take precedence over
1889: variables defined in the system environment, which take precedence
1890: over variables defined in the system-wide lesskey file.
1.38 jmc 1891: .Bl -tag -width LESSANSIENDCHARS
1.1 millert 1892: .It Ev COLUMNS
1893: Sets the number of columns on the screen.
1.41 jmc 1894: Takes precedence over the number of columns specified by the
1895: .Ev TERM
1896: variable,
1897: but may be overridden by window systems which support
1898: .Dv TIOCGWINSZ .
1.1 millert 1899: .It Ev EDITOR
1.41 jmc 1900: Specifies the default editor if
1901: .Ev VISUAL
1902: is not set.
1903: If neither are set,
1904: .Xr vi 1
1905: is used.
1.1 millert 1906: .It Ev HOME
1907: Name of the user's home directory
1908: (used to find a lesskey file).
1909: .It Ev LANG
1910: Language for determining the character set.
1911: .It Ev LC_CTYPE
1912: Language for determining the character set.
1913: .It Ev LESS
1914: Options which are passed to
1915: .Nm
1916: automatically.
1.38 jmc 1917: Command line options override the
1918: .Ev LESS
1919: environment variable.
1920: .Pp
1.44 ! bentley 1921: Some options like
! 1922: .Fl k
! 1923: require a string to follow the option letter.
1.38 jmc 1924: The string for that option is considered to end when a dollar sign ($) is found.
1925: For example, to separate a prompt value from any other options
1926: with dollar sign between them:
1927: .Pp
1928: .Dl LESS="-Ps--More--$-C -e"
1929: .Pp
1.44 ! bentley 1930: If the
! 1931: .Fl -use-backslash
! 1932: option appears earlier in the options, then
1.38 jmc 1933: a dollar sign or backslash may be included literally in an option string
1934: by preceding it with a backslash.
1.44 ! bentley 1935: If the
! 1936: .Fl -use-backslash
! 1937: option is not in effect, then backslashes are
1.38 jmc 1938: not treated specially, and there is no way to include a dollar sign
1939: in the option string.
1.1 millert 1940: .It Ev LESSANSIENDCHARS
1.23 shadchin 1941: Characters which may end an ANSI color escape sequence
1.1 millert 1942: (default "m").
1.23 shadchin 1943: .It Ev LESSANSIMIDCHARS
1944: Characters which may appear between the ESC character and the
1945: end character in an ANSI color escape sequence
1946: (default "0123456789;[?!"'#%()*+\ ").
1.1 millert 1947: .It Ev LESSBINFMT
1948: Format for displaying non-printable, non-control characters.
1949: .It Ev LESSCHARDEF
1950: Defines a character set.
1951: .It Ev LESSCHARSET
1952: Selects a predefined character set.
1953: .It Ev LESSCLOSE
1954: Command line to invoke the (optional) input-postprocessor.
1955: .It Ev LESSEDIT
1956: Editor prototype string (used for the v command).
1957: See discussion under
1958: .Sx PROMPTS .
1959: .It Ev LESSGLOBALTAGS
1.44 ! bentley 1960: Name of the command used by the
! 1961: .Fl t
! 1962: option to find global tags.
1.1 millert 1963: Normally should be set to "global" if your system has the global command.
1964: If not set, global tags are not used.
1.23 shadchin 1965: .It Ev LESSHISTFILE
1966: Name of the history file used to remember search commands and
1967: shell commands between invocations of
1968: .Nm less .
1969: If set to "-" or "/dev/null", a history file is not used.
1.25 nicm 1970: The default is "-".
1.23 shadchin 1971: .It Ev LESSHISTSIZE
1972: The maximum number of commands to save in the history file.
1973: The default is 100.
1.1 millert 1974: .It Ev LESSKEY
1975: Name of the default lesskey(1) file.
1976: .It Ev LESSKEY_SYSTEM
1977: Name of the default system-wide lesskey(1) file.
1978: .It Ev LESSMETACHARS
1979: List of characters which are considered "metacharacters" by the shell.
1980: .It Ev LESSMETAESCAPE
1981: Prefix which
1982: .Nm
1983: will add before each metacharacter in a command sent to the shell.
1984: If LESSMETAESCAPE is an empty string, commands containing
1985: metacharacters will not be passed to the shell.
1986: .It Ev LESSOPEN
1987: Command line to invoke the (optional) input-preprocessor.
1988: .It Ev LESSSECURE
1989: Runs less in "secure" mode.
1990: See discussion under
1991: .Sx SECURITY .
1992: .It Ev LESSSEPARATOR
1993: String to be appended to a directory name in filename completion.
1.23 shadchin 1994: .It Ev LESSUTFBINFMT
1995: Format for displaying non-printable Unicode code points.
1996: .It Ev LESS_IS_MORE
1997: Emulate the
1998: .Xr more 1
1999: command.
1.1 millert 2000: .It Ev LINES
2001: Sets the number of lines on the screen.
1.41 jmc 2002: Takes precedence over the number of lines specified by the TERM variable,
2003: but may be overridden by window systems which support
2004: .Dv TIOCGWINSZ .
1.32 shadchin 2005: .It Ev MORE
2006: Options which are passed to
2007: .Nm
1.35 jmc 2008: automatically when running in
1.39 jmc 2009: .Xr more 1
1.32 shadchin 2010: compatible mode.
1.1 millert 2011: .It Ev SHELL
2012: The shell used to execute the ! command, as well as to expand filenames.
2013: .It Ev TERM
1.41 jmc 2014: Specifies the terminal type.
2015: Used by
1.1 millert 2016: .Nm
1.41 jmc 2017: to get the terminal characteristics necessary to manipulate the screen.
1.1 millert 2018: .It Ev VISUAL
1.41 jmc 2019: Specifies the default editor.
2020: If not set,
2021: .Ev EDITOR is used;
2022: if that is not set,
2023: .Xr vi 1
2024: is used.
1.1 millert 2025: .El
2026: .Sh SEE ALSO
1.37 jmc 2027: .Xr lesskey 1 ,
2028: .Xr more 1
1.7 jmc 2029: .Sh AUTHORS
1.38 jmc 2030: .An Mark Nudelman .
1.7 jmc 2031: .Pp
1.32 shadchin 2032: Send bug reports or comments to
1.44 ! bentley 2033: .Aq Mt bug-less@gnu.org .
1.7 jmc 2034: .Pp
2035: For more information, see the less homepage at
1.28 schwarze 2036: .Lk http://www.greenwoodsoftware.com/less .