Closed sobolevn closed 4 months ago
Have you considered adding --no-color
to your $FZF_DEFAULT_OPTS
? It will suppress all colors from fzf.
Some colors are fine. But, the ones I've linked are too much :)
Okay then, what do you think about changing --color=always
to --color=${FZF_GIT_COLOR:-always}
? So you can export FZF_GIT_COLOR=auto
.
Looks good to me! π
I've given it some thought and I think we should follow https://no-color.org/.
Or maybe not? If fzf starts respecting $NO_COLOR
, you'll lose all colors.
I think that supporting NO_COLOR
is always a good thing. But, this is a global switch. I think that adding FZF_GIT_COLOR
is also a good idea. This way:
NO_COLOR
has the main priorityFZF_GIT_COLOR
has the second priorityBtw, _fzf_git_bat_options="--style='${BAT_STYLE:-full}' --color=$(__fzf_git_color) --pager=never"
this should be a different setting 100%
Disabling git
colors is not the same as code highlight, which is very needed.
How about this?
diff --git a/fzf-git.sh b/fzf-git.sh
index bef581d..27d01f0 100644
--- a/fzf-git.sh
+++ b/fzf-git.sh
@@ -27,11 +27,16 @@ __fzf_git_color() {
if [[ -n $NO_COLOR ]]; then
echo never
else
- echo always
+ echo ${FZF_GIT_COLOR:-always}
fi
}
__fzf_git_cat() {
+ if [[ -n $FZF_GIT_CAT ]]; then
+ echo $FZF_GIT_CAT
+ return
+ fi
+
# Sometimes bat is installed as batcat
_fzf_git_bat_options="--style='${BAT_STYLE:-full}' --color=$(__fzf_git_color) --pager=never"
if command -v batcat > /dev/null; then
amazing! π
That would allow something like this:
export FZF_GIT_COLOR=never
export FZF_GIT_CAT='bat --style=numbers --color=always'
But the problem with this is that, the preview window of CTRL-G-F has colors because it's using bat, but the preview windows of the other bindings, such as CTRL-G-H, do not.
So maybe we need another variable for controlling the colors in the preview window.
bd8ac4ba4c9d7d12b34f7fa2b0d334f50cdb5254
SO MUCH BETTER!
Before:
After:
Thanks a lot for the quick reply and quick fix! fzf is amazing :) I am integrating it into my workflow right now https://github.com/sobolevn/dotfiles?tab=readme-ov-file#fzf-goodies
And with export FZF_GIT_PREVIEW_COLOR=always
and FZF_GIT_COLOR=never
:
π
Hi! Great stuff.
Some people are not that great with colors. Can a mode without
git
colors be added please? I am specifically talking about things like:I would propose to add a setting called
FZF_GIT_NO_COLOR=true
to disable these colors :) Would you accept a PR like this?