To my understanding man uses less
as a pager, and when searching for keywords using less
it "highlights" keywords with italics. I find that really inconvenient, so I'd like to change this to something like vim's set hlsearch
where the found pattern has a different background.
I attempted to run man -P vim systemd
but that quit with error status 1, so it looks like I'm stuck with less
.
There was nothing that I was able to find in man less
that helped (instead I found out that option -G
will turn off highlighting all together which is even worse than italics).
That being said does anyone know how to achieve search highlighting (change background color) in man pages?
FYI I run Ubuntu 14.10
I came across this question seems to ask about the same thing but I am not sure if I follow how does this work (LESS_TERMCAP_so
). The less
man page does not mention this. (I get strange results with this solution)
Best Answer
Found an answer over on the superuser: https://superuser.com/questions/566082/less-doesnt-highlight-search
Looks like it has to do with your TERM setting. For example, less highlighting acts normally (white background highlight) when in a normal gnome-terminal window, but when I'm in tmux, italics happens. The difference for me is that TERM is being set to "screen" when in tmux, but "xterm-256color" when not. When I set "TERM=xterm-256color" in the tmux window, highlighting in less goes back to background highlighting.