How to center search results in Less, instead of moving matched line to top of terminal
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: The Builders
--
Chapters
00:00 How To Center Search Results In Less, Instead Of Moving Matched Line To Top Of Terminal
00:36 Accepted Answer Score 46
01:06 Thank you
--
Full question
https://superuser.com/questions/257605/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#less
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: The Builders
--
Chapters
00:00 How To Center Search Results In Less, Instead Of Moving Matched Line To Top Of Terminal
00:36 Accepted Answer Score 46
01:06 Thank you
--
Full question
https://superuser.com/questions/257605/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#less
#avk47
ACCEPTED ANSWER
Score 46
You can use the -j
option. From within less
, type - then j then enter a number of lines below the top of the screen for the target line to be displayed (e.g. 12).
You can start less
using this option:
less -j12
or set the LESS
environment variable to include it:
export LESS=-j12
My $LESS
is:
-iMFXRj4a#1
You can include setting the environment variable in your ~/.bashrc
file to make it persistent.