I open a manpage of some command, and then hit h.
- In the help, for the search part, what does "spanning files" mean?
- What are "files" refereed to?
I search a pattern, and hit n to repeat the previous search. I found there is no difference between n and ESC–n.
SEARCHING
/pattern * Search forward for (N-th) matching line.
?pattern * Search backward for (N-th) matching line.
n * Repeat previous search (for N-th occurrence).
N * Repeat previous search in reverse direction.
ESC-n * Repeat previous search, **spanning files**.
ESC-N * Repeat previous search, reverse dir. & **spanning files**.
ESC-u Undo (toggle) search highlighting.
&pattern * Display only matching lines
Best Answer
man
displays man pages using a pager - in your case,less
. When you press h, you're seeing less's help.So, as for what "spanning files" means, it's referring to searching across multiple files simultaneously opened in
less
.It doesn't apply to the man page use case (since there's only one file opened at the time), but if you did
at the command line, and then searched for a pattern that occurs in both files with
/foo
, you could jump between occurrences of the pattern insidefile1
using n repeatedly, but it would eventually stop when you hit the last occurrence in the file. At that point, if you were to hit Escn (or usually also Alt+n) it would jump you to the first occurrence of that pattern infile2
.