set tab width for less output
Yes, it is possible with less -x
or less --tabs
, e.g. less -x4
will set the tabwidth to 4.
You can configure defaults with the LESS
environment variable, e.g. LESS="-x4"
.
The less
-specific answer has already been given, but a generic solution (for any pager) is to expand the tabs
(with space characters) with the expand
command before feeding to the pager:
expand -t4 file | pager
Instead of setting the tab width in command line (before you open less
). You can also set the tab width within less
by typing -x4