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