" ... desirable if the deinitialization string does something unnecessary, like clearing the screen."
I prefer to not clear the screen. I usually want to continue to refer to something or even copy/paste from the content to my current command line.
Admittedly, they are a bit slow sometime and sure, you could use `grep -v` then pipe which is way faster, but they've saved me on removing noise from logfiles from time to time when you don't always know what to filter beforehand :).
EDIT: It was in TFA.
-L: skip preprocessing the input file. When opening rotated log files with the names like logfile.1, logfile.2... the default preprocessor on some distros will recognize them as man page source and helpfully pipe through nroff. If the file is largish this introduces an annoying pause. Using -L skips all that.
Ctrl-R as the first character of a search string will search for that literal string, not the regular expression. Nice if you have regex metacharacters in the search string and don't want to bother with escaping (and don't need the regex facilities, of course.)
1. Do `echo '^q toggle-option -redraw-screen\nq' >> ~/.config/lesskey`
2. Make sure `less` is invoked without `-X` (or with `-+X` if you want to be sure).
This `^q` command is particularly useful for `git log` output and other things where you might need to refer back to them in the next terminal command you do. (In fact, `git` uses `less -FRX` by default, so you'd need to override its config to use `less -FR` instead for the above to work as intended). The `q` command is useful when you don't want to lose what you had on the screen before invoking `less`.
I have a single line in my config[1] which binds s to back-scroll, so that d and s are right next to each other and I can quickly page up/down with one hand.
If you’re on macOS, you may not be able to use this unless you install less from Homebrew, or otherwise replace the default less.[2]
[1] https://github.com/jez/dotfiles/blob/master/lesskey#L2
[2] https://apple.stackexchange.com/questions/27269/is-less1-mis...
I set a mark, move to somewhere else, then save the area between where I am and the mark: ma(assign mark "a" to position), jjj(move three lines away), |a(pipe from current-position to the "a" mark then a ! prompt appears so enter...) cat >somefile (which dumps the selected text, cur-pos to mark "a", into somefile).
That was great for saving snippets of news or emails.
Also, the -j setting. Sets the line position for searches so context is available, eg using -j8 means the search is 8 lines from the top of the screen.
However while I think the feature is neat, a clever use of an existing feature, I never use it. I think it is sort of the same as info pages and why the technologically superior solution sort of lost to the stupider simpler man pages. Having a simple uniform interface "press / to search, all information in one document" is far less cognitively distracting than the better system.
And final thoughts: if unfamiliar the bsd's use the mdoc set of troff macros to build semantic man pages. sort of like how latex lets you build semantic documents on the tex typesetting engine. Where linux man pages are usually plain troff. OpenBSD actually went one step further and now uses a specific mandoc program to render them rather than the troff + mdoc macros that was used before.
Also useful for privilege escalation...
If a script running as root uses less (or vi), just do "!bash" and you have a root shell. Note that systems that let you do this are usually pretty weak, and there are often many other ways to get root access, but this is a particularly simple one that I used a few times in the past.
Thought I'd tag along to this submission and see if anyone has a recommendation?
But there are (at least) 150 Psalms! You're going to need more less tips to match that.