Less doesn’t highlight search

less

Something happened so I don't see less highlights any more. I've tried:

  • using different terminal.
  • using -g option
  • making sure -G isn't there
  • ^K while searching
  • ESCU

Nothing helps.

I work in Ubuntu 12.10 on an i3 desktop. $TERM=screen-256. When I use ^ ALT 1 to switch to TTY1 and do man man I can see that it highlights there both man parameters and search patterns.

What else can I do to fix it ?

Best Answer

The highlighting in TTY1 works since it sets the TERM variable to a proper value.

If you're using screen:

Change the TERM variable to a proper value (e.g., screen or screen-256color). Check your personal ~/.screenrc or the system-wide /etc/screenrc and fix the corresponding line.

In my version of less, the value screen-256 should actually results in an error:

WARNING: terminal is not fully functional
-  (press RETURN)

If you're not using screen:

The screen* only get interpreted correctly by screen.

The correct value for TERM depends on your terminal emulator and should usually get set by it. The default of Ubuntu's three pre-installed terminal emulators is xterm.

Execute

grep -R TERM= ~/.* /etc 2> /dev/null

the check if TERM's value gets overridden in your shell's configuration files.

Related Question