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

difftastic do not show color in fzf preview #716

Open
dsypasit opened this issue May 16, 2024 · 1 comment
Open

difftastic do not show color in fzf preview #716

dsypasit opened this issue May 16, 2024 · 1 comment

Comments

@dsypasit
Copy link

I tried to use difft to show the difference inside fzf. In the previous script, it showed colors but not in difft. However, when I used 'git show', it displayed correctly. What's wrong with it?

previous script

git log --oneline --format="%C(auto)%h %s%d" | fzf --ansi --preview "git show --color=always {1}" --bind 'enter:become(echo {1})'

image

using difftastic

git log --oneline --format="%C(auto)%h %s%d" | fzf --ansi --preview "GIT_EXTERNA_DIFF=difft git show --color=always {1} --ext-diff " --bind 'enter:become(echo {1})'

image

difftastic version

dotfile on  main [!⇡]
❯ difft --version
Difftastic 0.58.0 (0c9277108 2024-05-10, built with rustc 1.78.0)
@bvergnaud
Copy link

bvergnaud commented Jun 19, 2024

Hello 👋🏻

That's because difftastic, like many CLI tools, disables colored output by default when the output is redirected somewhere other than a terminal.

I've been configuring something similar for myself over the past couple of days so I can tell you it works for sure with this bit of git configuration:

[diff]
    external = difft --color=always

I'd assume you can do the same thing through the environment variable GIT_EXTERNAL_DIFF=difft --color=always but I haven't tested it.

Hope it helps. ;)

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

No branches or pull requests

2 participants