In a smaller pager, is there a way to show more rows before the search result?
I browse a lot less
, but it puts the search result at the very top of the screen, making it difficult to read the pages to read as I search for a word, but I really want the associated flag to this description, which can be several lines up.
Is there a way to show more lines at the top of the screen so that the cursor is something like 5-10 lines below the top of the screen? Something like vim
scrolloff
.
source to share
To show more lines of context before the search result, i.e. put the search result several lines down from the top of the screen instead of the top line, use:
less -jX
where X
is the number of lines below the top of the screen where you want your results to end.
If you generally prefer this style of search results and want to use it less all the time (eg in man
), put this setting in an environment variable $LESS
. For example, to always place a search result 5 lines down using bash, it would be:
export LESS=-j5
You can of course add any other parameters to the less
environment variable $LESS
if you like.
source to share