Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set tab size for hunks in "git add -p"?

I used the solution here to change tab size in git diff output. That works fine with git diff.

I have these settings in my .gitconfig:

[core]    
whitespace = tabsize=4,indent-with-non-tab
pager = less -FSRX -x4

But those settings seems does not affect on git add -p. How to set tab size for hunks in git add -p command?

like image 211
Alexander Yancharuk Avatar asked Aug 03 '13 16:08

Alexander Yancharuk


1 Answers

core.pager settings doesn't affect git add -p command because git add -p doesn't go through less/pager. To change hunks tabs size you need change the tabs size of your terminal. Found solution here. Just added in .bashrc:

env TERM=linux setterm -regtabs 4

That settings works fine in xterm terminals. For other terminal types check manuals for proper solution.

like image 137
Alexander Yancharuk Avatar answered Oct 20 '22 01:10

Alexander Yancharuk