Last Updated: February 25, 2016
·
718
· destructuring

Make less less annoying

Recently got a vcat script (not written by me) working on OSX which uses vim to syntax highlight files but instead of paging in the editor, it outputs ansi escape sequences.

Piping this to less revealed some annoyances in less I'd internalized for years.

To display the raw ANSI sequences so the terminal can display colors, use -R.

To stop less from initializing the screen and restoring the screen, use -X.

To silence beeps, use -Q.

To stop paging when the content is less than a page, use -F.

Here's what I currently have as a vcat alias:

vcat "$@" | less -R -Q -X -F

Set LESS with these options enable it by default:

export LESS="-R -Q -X -F"