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

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