[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.54

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