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

feat: make invert_diff configurable #291

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ require("gruvbox").setup({
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
invert_diff = false,
inverse = true, -- invert background for search, statuslines and errors
contrast = "", -- can be "hard", "soft" or empty string
palette_overrides = {},
overrides = {},
Expand Down
7 changes: 4 additions & 3 deletions lua/gruvbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Gruvbox.config = {
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
invert_diff = false,
inverse = true,
contrast = "",
palette_overrides = {},
Expand Down Expand Up @@ -360,9 +361,9 @@ local function get_groups()
PmenuSel = { fg = colors.bg2, bg = colors.blue, bold = config.bold },
PmenuSbar = { bg = colors.bg2 },
PmenuThumb = { bg = colors.bg4 },
DiffDelete = { bg = colors.dark_red },
DiffAdd = { bg = colors.dark_green },
DiffChange = { bg = colors.dark_aqua },
DiffDelete = config.invert_diff and { fg = colors.bg0, bg = colors.red } or { bg = colors.dark_red },
DiffAdd = config.invert_diff and { fg = colors.bg0, bg = colors.green } or { bg = colors.dark_green },
DiffChange = config.invert_diff and { fg = colors.bg0, bg = colors.aqua } or { bg = colors.dark_aqua },
Comment on lines +364 to +366

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style not quite a revert of the style, if the user has config.inverse = true.

Suggested change
DiffDelete = config.invert_diff and { fg = colors.bg0, bg = colors.red } or { bg = colors.dark_red },
DiffAdd = config.invert_diff and { fg = colors.bg0, bg = colors.green } or { bg = colors.dark_green },
DiffChange = config.invert_diff and { fg = colors.bg0, bg = colors.aqua } or { bg = colors.dark_aqua },
DiffDelete = config.invert_diff and { fg = colors.bg0, bg = colors.red, reverse = config.inverse } or { bg = colors.dark_red },
DiffAdd = config.invert_diff and { fg = colors.bg0, bg = colors.green, reverse = config.inverse } or { bg = colors.dark_green },
DiffChange = config.invert_diff and { fg = colors.bg0, bg = colors.aqua, reverse = config.inverse } or { bg = colors.dark_aqua },

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh, I think there are actually two things happening in the new configuration:

  • The colors changed.
  • And the reverse is unconditionally false.

I want both the old colours and reverse = true.

Whereas you only want the old colours?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right

DiffText = { bg = colors.yellow, fg = colors.bg0 },
SpellCap = { link = "GruvboxBlueUnderline" },
SpellBad = { link = "GruvboxRedUnderline" },
Expand Down
Loading