It would be nice, for 'git diff' to show symbols instead of colors


#1

It would be really nice to have the ability to choose symbols rather than the sliver of color currently presented with ‘git diff’. I’m colorblind and the method for showing add/mods/deletes is essentially impossible to use in it’s current mode. I also have a coworker who is not colorblind, but is used to see diff symbols (+,-, etc.) to indicate changes (and find the colors very difficult to discern). Coming from SublimeText in particular, git gutter is one of our favorite plugins.


#2

I agree. I’m not colour-blind myself, but I have poor eyesight. I have to put effort into figuring out the colour and what it means; symbols are a lot easier to discern.

For those who prefer the colour-only gutter, I imagine this could be configurable.

The git-diff package which renders in the gutter diffs is on Github. I’m tempted to have a go at implementing this and making a pull request.


#3

Here a bit of LESS/CSS I’ve hacked together to quickly fix this. You can add to your styles.less file. It adds - + ~ symbols to the diffed lines. It could perhaps be made a little nicer, but it’s a start.

.editor {
  .gutter .line-number {
    &.git-line-modified,
    &.git-line-added,
    &.git-line-removed {
      padding-left: ~"calc(1.4em - 2px)";

      &:before {
        position: absolute;
        left: 4px;
      }
    }

    &.git-line-modified:before {
      content: '~';
    }

    &.git-line-added:before {
      content: '+';
    }

    &.git-line-removed:before {
      content: '-';
    }
  }
}

#4

FYI: Symbols/icons were added to git-diff a couple of versions back. If you’ve got git-diff 0.27.0+ there’s a setting to turn them on.