xref: /freebsd/contrib/less/less.hlp (revision d713e089)
1a5f0fb15SPaul Saab
2a5f0fb15SPaul Saab                   SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS
3a5f0fb15SPaul Saab
4a5f0fb15SPaul Saab      Commands marked with * may be preceded by a number, _N.
5a5f0fb15SPaul Saab      Notes in parentheses indicate the behavior if _N is given.
6e2449719SXin LI      A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
7a5f0fb15SPaul Saab
8a5f0fb15SPaul Saab  h  H                 Display this help.
9a5f0fb15SPaul Saab  q  :q  Q  :Q  ZZ     Exit.
10a5f0fb15SPaul Saab ---------------------------------------------------------------------------
11a5f0fb15SPaul Saab
12a5f0fb15SPaul Saab                           MMOOVVIINNGG
13a5f0fb15SPaul Saab
14a5f0fb15SPaul Saab  e  ^E  j  ^N  CR  *  Forward  one line   (or _N lines).
15a5f0fb15SPaul Saab  y  ^Y  k  ^K  ^P  *  Backward one line   (or _N lines).
16a5f0fb15SPaul Saab  f  ^F  ^V  SPACE  *  Forward  one window (or _N lines).
17a5f0fb15SPaul Saab  b  ^B  ESC-v      *  Backward one window (or _N lines).
18a5f0fb15SPaul Saab  z                 *  Forward  one window (and set window to _N).
19a5f0fb15SPaul Saab  w                 *  Backward one window (and set window to _N).
20a5f0fb15SPaul Saab  ESC-SPACE         *  Forward  one window, but don't stop at end-of-file.
21a5f0fb15SPaul Saab  d  ^D             *  Forward  one half-window (and set half-window to _N).
22a5f0fb15SPaul Saab  u  ^U             *  Backward one half-window (and set half-window to _N).
23f6b74a7dSXin LI  ESC-)  RightArrow *  Right one half screen width (or _N positions).
24f6b74a7dSXin LI  ESC-(  LeftArrow  *  Left  one half screen width (or _N positions).
25f6b74a7dSXin LI  ESC-}  ^RightArrow   Right to last column displayed.
26f6b74a7dSXin LI  ESC-{  ^LeftArrow    Left  to first column.
27a5f0fb15SPaul Saab  F                    Forward forever; like "tail -f".
28a15691bfSXin LI  ESC-F                Like F but stop when search pattern is found.
29a5f0fb15SPaul Saab  r  ^R  ^L            Repaint screen.
30a5f0fb15SPaul Saab  R                    Repaint screen, discarding buffered input.
31a5f0fb15SPaul Saab        ---------------------------------------------------
32a5f0fb15SPaul Saab        Default "window" is the screen height.
33a5f0fb15SPaul Saab        Default "half-window" is half of the screen height.
34a5f0fb15SPaul Saab ---------------------------------------------------------------------------
35a5f0fb15SPaul Saab
36a5f0fb15SPaul Saab                          SSEEAARRCCHHIINNGG
37a5f0fb15SPaul Saab
38a5f0fb15SPaul Saab  /_p_a_t_t_e_r_n          *  Search forward for (_N-th) matching line.
39a5f0fb15SPaul Saab  ?_p_a_t_t_e_r_n          *  Search backward for (_N-th) matching line.
40a5f0fb15SPaul Saab  n                 *  Repeat previous search (for _N-th occurrence).
41a5f0fb15SPaul Saab  N                 *  Repeat previous search in reverse direction.
42a5f0fb15SPaul Saab  ESC-n             *  Repeat previous search, spanning files.
43a5f0fb15SPaul Saab  ESC-N             *  Repeat previous search, reverse dir. & spanning files.
44a5f0fb15SPaul Saab  ESC-u                Undo (toggle) search highlighting.
452235c7feSXin LI  ESC-U                Clear search highlighting.
462235c7feSXin LI  &_p_a_t_t_e_r_n          *  Display only matching lines.
47a5f0fb15SPaul Saab        ---------------------------------------------------
48b7780dbeSXin LI        A search pattern may begin with one or more of:
49a5f0fb15SPaul Saab        ^N or !  Search for NON-matching lines.
50a5f0fb15SPaul Saab        ^E or *  Search multiple files (pass thru END OF FILE).
51a5f0fb15SPaul Saab        ^F or @  Start search at FIRST file (for /) or last file (for ?).
52a5f0fb15SPaul Saab        ^K       Highlight matches, but don't move (KEEP position).
53a5f0fb15SPaul Saab        ^R       Don't use REGULAR EXPRESSIONS.
54d713e089SXin LI        ^S _n     Search for match in _n-th parenthesized subpattern.
552235c7feSXin LI        ^W       WRAP search if no match found.
56a5f0fb15SPaul Saab ---------------------------------------------------------------------------
57a5f0fb15SPaul Saab
58a5f0fb15SPaul Saab                           JJUUMMPPIINNGG
59a5f0fb15SPaul Saab
60a5f0fb15SPaul Saab  g  <  ESC-<       *  Go to first line in file (or line _N).
61a5f0fb15SPaul Saab  G  >  ESC->       *  Go to last line in file (or line _N).
62a5f0fb15SPaul Saab  p  %              *  Go to beginning of file (or _N percent into file).
63c9346414SPaul Saab  t                 *  Go to the (_N-th) next tag.
64c9346414SPaul Saab  T                 *  Go to the (_N-th) previous tag.
65a5f0fb15SPaul Saab  {  (  [           *  Find close bracket } ) ].
66a5f0fb15SPaul Saab  }  )  ]           *  Find open bracket { ( [.
67a5f0fb15SPaul Saab  ESC-^F _<_c_1_> _<_c_2_>  *  Find close bracket _<_c_2_>.
682235c7feSXin LI  ESC-^B _<_c_1_> _<_c_2_>  *  Find open bracket _<_c_1_>.
69a5f0fb15SPaul Saab        ---------------------------------------------------
70a5f0fb15SPaul Saab        Each "find close bracket" command goes forward to the close bracket
71a5f0fb15SPaul Saab          matching the (_N-th) open bracket in the top line.
72a5f0fb15SPaul Saab        Each "find open bracket" command goes backward to the open bracket
73a5f0fb15SPaul Saab          matching the (_N-th) close bracket in the bottom line.
74a5f0fb15SPaul Saab
75b2ea2440SXin LI  m_<_l_e_t_t_e_r_>            Mark the current top line with <letter>.
76b2ea2440SXin LI  M_<_l_e_t_t_e_r_>            Mark the current bottom line with <letter>.
77a5f0fb15SPaul Saab  '_<_l_e_t_t_e_r_>            Go to a previously marked position.
78a5f0fb15SPaul Saab  ''                   Go to the previous position.
79a5f0fb15SPaul Saab  ^X^X                 Same as '.
8095270f73SXin LI  ESC-m_<_l_e_t_t_e_r_>        Clear a mark.
81a5f0fb15SPaul Saab        ---------------------------------------------------
82a5f0fb15SPaul Saab        A mark is any upper-case or lower-case letter.
83a5f0fb15SPaul Saab        Certain marks are predefined:
84a5f0fb15SPaul Saab             ^  means  beginning of the file
85a5f0fb15SPaul Saab             $  means  end of the file
86a5f0fb15SPaul Saab ---------------------------------------------------------------------------
87a5f0fb15SPaul Saab
88a5f0fb15SPaul Saab                        CCHHAANNGGIINNGG FFIILLEESS
89a5f0fb15SPaul Saab
90a5f0fb15SPaul Saab  :e [_f_i_l_e]            Examine a new file.
91a5f0fb15SPaul Saab  ^X^V                 Same as :e.
92a5f0fb15SPaul Saab  :n                *  Examine the (_N-th) next file from the command line.
93a5f0fb15SPaul Saab  :p                *  Examine the (_N-th) previous file from the command line.
94a5f0fb15SPaul Saab  :x                *  Examine the first (or _N-th) file from the command line.
95a5f0fb15SPaul Saab  :d                   Delete the current file from the command line list.
96a5f0fb15SPaul Saab  =  ^G  :f            Print current file name.
97a5f0fb15SPaul Saab ---------------------------------------------------------------------------
98a5f0fb15SPaul Saab
99a5f0fb15SPaul Saab                    MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS
100a5f0fb15SPaul Saab
101a5f0fb15SPaul Saab  -_<_f_l_a_g_>              Toggle a command line option [see OPTIONS below].
102a5f0fb15SPaul Saab  --_<_n_a_m_e_>             Toggle a command line option, by name.
103a5f0fb15SPaul Saab  __<_f_l_a_g_>              Display the setting of a command line option.
104a5f0fb15SPaul Saab  ___<_n_a_m_e_>             Display the setting of an option, by name.
105a5f0fb15SPaul Saab  +_c_m_d                 Execute the less cmd each time a new file is examined.
106a5f0fb15SPaul Saab
107a5f0fb15SPaul Saab  !_c_o_m_m_a_n_d             Execute the shell command with $SHELL.
108d713e089SXin LI  #_c_o_m_m_a_n_d             Execute the shell command, expanded like a prompt.
109a5f0fb15SPaul Saab  |XX_c_o_m_m_a_n_d            Pipe file between current pos & mark XX to shell command.
110f6b74a7dSXin LI  s _f_i_l_e               Save input to a file.
111a5f0fb15SPaul Saab  v                    Edit the current file with $VISUAL or $EDITOR.
112a5f0fb15SPaul Saab  V                    Print version number of "less".
113a5f0fb15SPaul Saab ---------------------------------------------------------------------------
114a5f0fb15SPaul Saab
115a5f0fb15SPaul Saab                           OOPPTTIIOONNSS
116a5f0fb15SPaul Saab
117a5f0fb15SPaul Saab        Most options may be changed either on the command line,
118a5f0fb15SPaul Saab        or from within less by using the - or -- command.
119a5f0fb15SPaul Saab        Options may be given in one of two forms: either a single
1207bd2567cSXin LI        character preceded by a -, or a name preceded by --.
121a5f0fb15SPaul Saab
122a5f0fb15SPaul Saab  -?  ........  --help
123a5f0fb15SPaul Saab                  Display help (from command line).
124a5f0fb15SPaul Saab  -a  ........  --search-skip-screen
12596e55cc7SXin LI                  Search skips current screen.
12633096f16SXin LI  -A  ........  --SEARCH-SKIP-SCREEN
12796e55cc7SXin LI                  Search starts just after target line.
128a5f0fb15SPaul Saab  -b [_N]  ....  --buffers=[_N]
129a5f0fb15SPaul Saab                  Number of buffers.
130a5f0fb15SPaul Saab  -B  ........  --auto-buffers
131a5f0fb15SPaul Saab                  Don't automatically allocate buffers for pipes.
1327f074f9cSXin LI  -c  ........  --clear-screen
1337f074f9cSXin LI                  Repaint by clearing rather than scrolling.
134a5f0fb15SPaul Saab  -d  ........  --dumb
135a5f0fb15SPaul Saab                  Dumb terminal.
1362235c7feSXin LI  -D xx_c_o_l_o_r  .  --color=xx_c_o_l_o_r
1372235c7feSXin LI                  Set screen colors.
138a5f0fb15SPaul Saab  -e  -E  ....  --quit-at-eof  --QUIT-AT-EOF
139a5f0fb15SPaul Saab                  Quit at end of file.
140a5f0fb15SPaul Saab  -f  ........  --force
141a5f0fb15SPaul Saab                  Force open non-regular files.
142a5f0fb15SPaul Saab  -F  ........  --quit-if-one-screen
143a5f0fb15SPaul Saab                  Quit if entire file fits on first screen.
144a5f0fb15SPaul Saab  -g  ........  --hilite-search
145a5f0fb15SPaul Saab                  Highlight only last match for searches.
146a5f0fb15SPaul Saab  -G  ........  --HILITE-SEARCH
147a5f0fb15SPaul Saab                  Don't highlight any matches for searches.
148a5f0fb15SPaul Saab  -h [_N]  ....  --max-back-scroll=[_N]
149a5f0fb15SPaul Saab                  Backward scroll limit.
150a5f0fb15SPaul Saab  -i  ........  --ignore-case
151a5f0fb15SPaul Saab                  Ignore case in searches that do not contain uppercase.
152a5f0fb15SPaul Saab  -I  ........  --IGNORE-CASE
153a5f0fb15SPaul Saab                  Ignore case in all searches.
154a5f0fb15SPaul Saab  -j [_N]  ....  --jump-target=[_N]
155a5f0fb15SPaul Saab                  Screen position of target lines.
1568ed69c6fSPaul Saab  -J  ........  --status-column
1578ed69c6fSPaul Saab                  Display a status column at left edge of screen.
158a5f0fb15SPaul Saab  -k [_f_i_l_e]  .  --lesskey-file=[_f_i_l_e]
159a5f0fb15SPaul Saab                  Use a lesskey file.
160b7780dbeSXin LI  -K  ........  --quit-on-intr
16133096f16SXin LI                  Exit less in response to ctrl-C.
162000ba3e8STim J. Robbins  -L  ........  --no-lessopen
163000ba3e8STim J. Robbins                  Ignore the LESSOPEN environment variable.
164a5f0fb15SPaul Saab  -m  -M  ....  --long-prompt  --LONG-PROMPT
165a5f0fb15SPaul Saab                  Set prompt style.
16695270f73SXin LI  -n .........  --line-numbers
16795270f73SXin LI                  Suppress line numbers in prompts and messages.
16895270f73SXin LI  -N .........  --LINE-NUMBERS
16995270f73SXin LI                  Display line number at start of each line.
170a5f0fb15SPaul Saab  -o [_f_i_l_e]  .  --log-file=[_f_i_l_e]
171a5f0fb15SPaul Saab                  Copy to log file (standard input only).
172a5f0fb15SPaul Saab  -O [_f_i_l_e]  .  --LOG-FILE=[_f_i_l_e]
173a5f0fb15SPaul Saab                  Copy to log file (unconditionally overwrite).
174a5f0fb15SPaul Saab  -p [_p_a_t_t_e_r_n]  --pattern=[_p_a_t_t_e_r_n]
175a5f0fb15SPaul Saab                  Start at pattern (from command line).
176a5f0fb15SPaul Saab  -P [_p_r_o_m_p_t]   --prompt=[_p_r_o_m_p_t]
177a5f0fb15SPaul Saab                  Define new prompt.
178a5f0fb15SPaul Saab  -q  -Q  ....  --quiet  --QUIET  --silent --SILENT
179a5f0fb15SPaul Saab                  Quiet the terminal bell.
180a5f0fb15SPaul Saab  -r  -R  ....  --raw-control-chars  --RAW-CONTROL-CHARS
181a5f0fb15SPaul Saab                  Output "raw" control characters.
182a5f0fb15SPaul Saab  -s  ........  --squeeze-blank-lines
183a5f0fb15SPaul Saab                  Squeeze multiple blank lines.
184a5f0fb15SPaul Saab  -S  ........  --chop-long-lines
18596e55cc7SXin LI                  Chop (truncate) long lines rather than wrapping.
186a5f0fb15SPaul Saab  -t [_t_a_g]  ..  --tag=[_t_a_g]
187a5f0fb15SPaul Saab                  Find a tag.
188a5f0fb15SPaul Saab  -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e]
189a5f0fb15SPaul Saab                  Use an alternate tags file.
190a5f0fb15SPaul Saab  -u  -U  ....  --underline-special  --UNDERLINE-SPECIAL
191d713e089SXin LI                  Change handling of backspaces, tabs and carriage returns.
192a5f0fb15SPaul Saab  -V  ........  --version
193a5f0fb15SPaul Saab                  Display the version number of "less".
194a5f0fb15SPaul Saab  -w  ........  --hilite-unread
195a5f0fb15SPaul Saab                  Highlight first new line after forward-screen.
196a5f0fb15SPaul Saab  -W  ........  --HILITE-UNREAD
197a5f0fb15SPaul Saab                  Highlight first new line after any forward movement.
198c9346414SPaul Saab  -x [_N[,...]]  --tabs=[_N[,...]]
199a5f0fb15SPaul Saab                  Set tab stops.
200a5f0fb15SPaul Saab  -X  ........  --no-init
201a5f0fb15SPaul Saab                  Don't use termcap init/deinit strings.
202a5f0fb15SPaul Saab  -y [_N]  ....  --max-forw-scroll=[_N]
203a5f0fb15SPaul Saab                  Forward scroll limit.
204a5f0fb15SPaul Saab  -z [_N]  ....  --window=[_N]
205a5f0fb15SPaul Saab                  Set size of window.
206a5f0fb15SPaul Saab  -" [_c[_c]]  .  --quotes=[_c[_c]]
207a5f0fb15SPaul Saab                  Set shell quote characters.
208a5f0fb15SPaul Saab  -~  ........  --tilde
209a5f0fb15SPaul Saab                  Don't display tildes after end of file.
2108ed69c6fSPaul Saab  -# [_N]  ....  --shift=[_N]
2112235c7feSXin LI                  Set horizontal scroll amount (0 = one half screen width).
212d713e089SXin LI                --exit-follow-on-close
213d713e089SXin LI                  Exit F command on a pipe when writer closes pipe.
21430a1828cSXin LI                --file-size
21530a1828cSXin LI                  Automatically determine the size of the input file.
216b7780dbeSXin LI                --follow-name
21733096f16SXin LI                  The F command changes files if the input file is renamed.
21895270f73SXin LI                --header=[_N[,_M]]
21995270f73SXin LI                  Use N lines and M columns to display file headers.
2202235c7feSXin LI                --incsearch
2212235c7feSXin LI                  Search file as each pattern character is typed in.
222d713e089SXin LI                --intr=_C
223d713e089SXin LI                  Use _C instead of ^X to interrupt a read.
224d713e089SXin LI                --line-num-width=_N
225d713e089SXin LI                  Set the width of the -N line number field to _N characters.
226d713e089SXin LI                --modelines=_N
227d713e089SXin LI                  Read _N lines from the input file and look for vim modelines.
228b7780dbeSXin LI                --mouse
229b7780dbeSXin LI                  Enable mouse input.
230b7780dbeSXin LI                --no-keypad
231b7780dbeSXin LI                  Don't send termcap keypad init/deinit strings.
232b7780dbeSXin LI                --no-histdups
233b7780dbeSXin LI                  Remove duplicates from command history.
23495270f73SXin LI                --no-number-headers
23595270f73SXin LI                  Don't give line numbers to header lines.
236d713e089SXin LI                --no-search-headers
237d713e089SXin LI                  Don't search in header lines or columns.
238d713e089SXin LI                --no-vbell
239d713e089SXin LI                  Disable the terminal's visual bell.
24095270f73SXin LI                --redraw-on-quit
24195270f73SXin LI                  Redraw final screen when quitting.
242d713e089SXin LI                --rscroll=_C
243b7780dbeSXin LI                  Set the character used to mark truncated lines.
244b7780dbeSXin LI                --save-marks
245b7780dbeSXin LI                  Retain marks across invocations of less.
24695270f73SXin LI                --search-options=[EFKNRW-]
24795270f73SXin LI                  Set default options for every search.
248d713e089SXin LI                --show-preproc-errors
249d713e089SXin LI                  Display a message if preprocessor exits with an error status.
250d713e089SXin LI                --proc-backspace
251d713e089SXin LI                  Process backspaces for bold/underline.
252d713e089SXin LI                --SPECIAL-BACKSPACE
253d713e089SXin LI                  Treat backspaces as control characters.
254d713e089SXin LI                --proc-return
255d713e089SXin LI                  Delete carriage returns before newline.
256d713e089SXin LI                --SPECIAL-RETURN
257d713e089SXin LI                  Treat carriage returns as control characters.
258d713e089SXin LI                --proc-tab
259d713e089SXin LI                  Expand tabs to spaces.
260d713e089SXin LI                --SPECIAL-TAB
261d713e089SXin LI                  Treat tabs as control characters.
262d713e089SXin LI                --status-col-width=_N
263d713e089SXin LI                  Set the width of the -J status column to _N characters.
26495270f73SXin LI                --status-line
26595270f73SXin LI                  Highlight or color the entire line containing a mark.
266b7780dbeSXin LI                --use-backslash
267a15691bfSXin LI                  Subsequent options use backslash as escape char.
2682235c7feSXin LI                --use-color
2692235c7feSXin LI                  Enables colored text.
270d713e089SXin LI                --wheel-lines=_N
271d713e089SXin LI                  Each click of the mouse wheel moves _N lines.
272d713e089SXin LI                --wordwrap
273d713e089SXin LI                  Wrap lines at spaces.
27433096f16SXin LI
2758ed69c6fSPaul Saab
276a5f0fb15SPaul Saab ---------------------------------------------------------------------------
277a5f0fb15SPaul Saab
278a5f0fb15SPaul Saab                          LLIINNEE EEDDIITTIINNGG
279a5f0fb15SPaul Saab
280a5f0fb15SPaul Saab        These keys can be used to edit text being entered
281a5f0fb15SPaul Saab        on the "command line" at the bottom of the screen.
282a5f0fb15SPaul Saab
283a15691bfSXin LI RightArrow ..................... ESC-l ... Move cursor right one character.
284a15691bfSXin LI LeftArrow ...................... ESC-h ... Move cursor left one character.
285a15691bfSXin LI ctrl-RightArrow  ESC-RightArrow  ESC-w ... Move cursor right one word.
286a15691bfSXin LI ctrl-LeftArrow   ESC-LeftArrow   ESC-b ... Move cursor left one word.
287a15691bfSXin LI HOME ........................... ESC-0 ... Move cursor to start of line.
288a15691bfSXin LI END ............................ ESC-$ ... Move cursor to end of line.
289a15691bfSXin LI BACKSPACE ................................ Delete char to left of cursor.
290a15691bfSXin LI DELETE ......................... ESC-x ... Delete char under cursor.
291a15691bfSXin LI ctrl-BACKSPACE   ESC-BACKSPACE ........... Delete word to left of cursor.
292a15691bfSXin LI ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
293a15691bfSXin LI ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
294a15691bfSXin LI UpArrow ........................ ESC-k ... Retrieve previous command line.
295a15691bfSXin LI DownArrow ...................... ESC-j ... Retrieve next command line.
296a15691bfSXin LI TAB ...................................... Complete filename & cycle.
297a15691bfSXin LI SHIFT-TAB ...................... ESC-TAB   Complete filename & reverse cycle.
298a15691bfSXin LI ctrl-L ................................... Complete filename, list all.
299