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

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