Make Less Options Permanent or the Missing Lessrc
Let’s have a look at how we can make certain
less preferences permanent,
-I, for example, which will make search case insensitive.
In GNU/Linux, preferences are often stored in
rc files. For
vim we have
.vimrc, for Bash
$ find "$HOME" -maxdepth 1 -name '*rc' ./.vimrc ./.idlerc ./.xinitrc ./.lynxrc ./.old_netrc ./.inputrc ./.bashrc ./.rtorrent.rc ./.sqliterc ./.xdvirc
So, it would make sense to expect a
.lessrc. But there is none.
Instead, we define a environment variable
-I: ignore case when searching
-F: quit immediately when the entire file fits in one screen (in effect, mimic
-R: enable colored output (for example, when piping to
-S: truncate long lines instead of wrapping them to the next line
-X: don’t clear screen on exit
man 1 less for all options.