[BACK]Return to less.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / less

Annotation of src/usr.bin/less/less.1, Revision 1.56

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