The Coding Journal ツ

Home

Impressum

x3ro’s Toolkit

I usually work with a tab width of 4 when editing code, but git-diff (that is the *nix less program) seems to use a default tab width of 8. You can change this behavior by setting the core.pager option to something like this:

This would result in a tab width of 4. If you are not familiar with git config, here’s how you set the option:

If you remove the --global flag, the option will be changed only for the current git repository, otherwise it will be changed globally for the current user account.

I usually work with a tab width of 4 when editing code, but git-diff (that is the *nix less program) seems to use a default tab width of 8. You...

Will on January 31, 2012 at 2:59 pm said: Good tip, though I used “-x 5,9″, making the first tab stop 5 characters, to allow for the “+” or “-” column in the git diff. Works perfectly on my OS X machine. However, Git Bash on Windows doesn’t seem to behave. Reply ↓ Lucas on January 31, 2012 at 3:44 pm said: I’d guess that less is only a symlink to some crippled version of more in Git Bash, but I can’t currently verify it. You can probably install or compile less from source to get the same behavior as on a proper *nix machine. Reply ↓

Good tip, though I used “-x 5,9″, making the first tab stop 5 characters, to allow for the “+” or “-” column in the git diff.

Works perfectly on my OS X machine. However, Git Bash on Windows doesn’t seem to behave.

Lucas on January 31, 2012 at 3:44 pm said: I’d guess that less is only a symlink to some crippled version of more in Git Bash, but I can’t currently verify it. You can probably install or compile less from source to get the same behavior as on a proper *nix machine. Reply ↓

I’d guess that less is only a symlink to some crippled version of more in Git Bash, but I can’t currently verify it. You can probably install or compile less from source to get the same behavior as on a proper *nix machine.

Robert W. on March 26, 2015 at 2:43 pm said: Great topic! But the best configuration so far is $ git config –global core.pager ‘less -x1,5′ See: http://stackoverflow.com/a/10584237 See why: https://gist.github.com/robertwhitebit/baa4eac5ed0a974a9af3 jfi, I’m using an Ubuntu 14.10 machine Reply ↓

Great topic!

But the best configuration so far is $ git config –global core.pager ‘less -x1,5′

See: http://stackoverflow.com/a/10584237 See why: https://gist.github.com/robertwhitebit/baa4eac5ed0a974a9af3

jfi, I’m using an Ubuntu 14.10 machine

Your email address will not be published. Required fields are marked *

Name *

Email *

Website

Comment

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>