Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color-words support #47

Open
Oblomov opened this issue Apr 30, 2012 · 21 comments
Open

color-words support #47

Oblomov opened this issue Apr 30, 2012 · 21 comments
Labels
Milestone

Comments

@Oblomov
Copy link
Contributor

Oblomov commented Apr 30, 2012

Currently, tig has no support for color-words in diffs. In fact, starting tig wit the --color-words option fails with "No revisions match the given argument" (which is quite misleading as error message).

This should probably be consiered a long-term TODO, as it requires some heavy-duty re-engineering of the diff view, especially with respect to highlighting. Also, color-word support would require massaging the input parameters, since the word-diff option should always be turned into 'porcelain'.

@jonas
Copy link
Owner

jonas commented Apr 30, 2012

While looking at issue #26, I have been looking into adding support for --word-diff=porcelain as a way to provide side-by-side diff support. AFAIK, the parsing of the word diff can be shared, but will require different rendering methods. So yeah, I agree that it will require some work to get proper highlighting. For example, the line->data member will probably have to become a struct of line boxes on which we can attach color and length information. Since the diff view shares a lot of code with the pager and stage view it probably makes sense to also use this line box struct for all the current 'pager-based' views.

@franciscolourenco
Copy link

+1 --color-words

@danielhopkins
Copy link

Yes, great goal!

@danielhopkins
Copy link

Would also be great if this supported --word-regex as well. It's sometimes nice to do a character diff. This would be a handy toggle setting too.

Line Diff -> Word Diff -> Character Diff

@danielhopkins
Copy link

Okay, I got ahead of myself. After learning a bit more. Porcelain support looks like it would be great. Github seems to have this dialed in, so hopefully using something like they do would be helpful :)

@zyv
Copy link

zyv commented Aug 14, 2012

Support for word-diff would be just awesome!

@metaodi
Copy link

metaodi commented Jun 6, 2013

+1 for this feature. In the meantime I helped myself with an external command to have easy access to the output from within tig.

status= W !git diff --color-words --cached %(file)

@vivien vivien mentioned this issue Nov 11, 2013
@xapple
Copy link

xapple commented Apr 24, 2014

+1 --color-words

@jeremyckahn
Copy link

+1, this would make diffs much easier!

@langner
Copy link

langner commented May 30, 2014

+1

2 similar comments
@xapple
Copy link

xapple commented Nov 12, 2014

+1

@nkmry
Copy link

nkmry commented Dec 6, 2014

+1

@wilzbach
Copy link

Any news on this? It's been open for more than four years now ;-)

@jonas jonas modified the milestones: tig-2.2, tig-2.3 Aug 13, 2016
@timotheecour
Copy link

+1

@jonas jonas modified the milestones: tig-2.3, tig-2.4 Jul 10, 2017
@hhartz
Copy link

hhartz commented Feb 21, 2018

attempted exporting TIG_DIFF_OPTS=--color-words but no luck, seems inline color escapes are not supported?

+1

@petRUShka
Copy link

+1 very useful. Why one should leave tig to get colored diff (with options)?

@SassNinja
Copy link

+1 for this feature

I've just discovered tig but without --color-words it's much less valuable for me than it would be with it

@avatar-lavventura
Copy link

Any improvement in this feature?

@hydrargyrum
Copy link

If I'm not mistaken, it is implemented in tig 2.5.5. I added this to my tigrc:

bind diff D :toggle word-diff

and it works like a charm when pressing shift-d (the separators are a bit verbose, but this is git's plain mode, not tig's fault).

@trygveaa
Copy link

the separators are a bit verbose, but this is git's plain mode, not tig's fault

I don't think you can argue that it's git's fault when git has a color mode for the word diff. I, and I would assume most people, would like this way to display it, not the plain way.

@hydrargyrum
Copy link

Maybe the selected word-diff mode should be configurable in tig then. Plain mode is still useful for example if the terminal has no color support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests