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

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