Ever since I began to use Linux, I always had to scroll back up a few lines to see the context of matched text after searching. So, I ended up pressing quite a lot of k after each n.

less command has an option called --jump-target=n or -jn, where n is a number. If you set it to .5, then the target that is matched text in this case will be scrolled to the middle of lines in the screen and thats exactly what I want, seeing the context.

You can try it out right while less is running, just simply type in -j.5 and Enter. less has a strange way to accept options during the runtime, I was quite amazed when I realized how to toggle ignore case option by type in -i.

To make it permanent, you can change LESS environment variable to

LESS="$LESS -j.5"

Or using lesskey by creating ~/.lesskey first like the following one:

#env
LESS = -j.5

Run lesskey to compile it into a ~/.less which will be read by less. Dont forget to add whatever options less currently using.