I like my tabs displayed as 4 spaces, and for that I have the preference core.pager = 'less -x4'
.
I know that at this point I'm nitpicking, but I'd love for the leading tab to be 4 spaces even in diff mode, which is obviously the most commonly used -- however it displays as only 3 due to the leading +
, -
, or . This is slightly annoying due to aligned lines, if some have no leading tabs they are shifted by 1 column compared to the others.
I can correct the display for diffs with less -x1,5
to get 4-space tabs, aligned on the column 1 modulo 4. However this option then causes the leading tab to be displayed as 1 column in non-diff mode, which in turn is highly disturbing.
So for two concrete examples, how can I set git options such that I use:
less -x1,5
for a diff (or really patch-displaying) command such as git diff
or git show HEAD
less -x4
for a command that does not display a diff such as git show HEAD~1:package.json
I'm sure there has to be a different renderer for what are basically diff
and cat
operations, but I haven't been able to find specific options for those (though they might exist, there's a lot of noise on git topics). I don't want to write a whole lot of aliases either, that's a little too dirty. So is this even possible?
pager.<cmd>
allows to set pager for a command:
git config [--global] pager.diff "less -x1,5"
git config [--global] pager.show "less -x4"