From a61afc55f6ea6e84d9dd98bd1ee2222296992657 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Wed, 22 Mar 2023 23:30:44 -0400 Subject: [PATCH] Fix gruvbox diff colors See: https://github.com/ellisonleao/gruvbox.nvim/issues/105#issuecomment-1480547367 --- after/plugin/gruvbox.lua | 16 ++++++++++++++++ lua/install-plugins.lua | 14 ++++++++------ lua/plugins/gruvbox.lua | 10 ---------- 3 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 after/plugin/gruvbox.lua diff --git a/after/plugin/gruvbox.lua b/after/plugin/gruvbox.lua new file mode 100644 index 0000000..6b6d9d7 --- /dev/null +++ b/after/plugin/gruvbox.lua @@ -0,0 +1,16 @@ +local colors = require("gruvbox.palette").colors; + +function FixGruvbox() + vim.api.nvim_set_hl(0, 'DiffviewDiffAddAsDelete', { bg = "#431313" }) + vim.api.nvim_set_hl(0, 'DiffDelete', { bg = "none", fg = colors.dark2 }) + vim.api.nvim_set_hl(0, 'DiffviewDiffDelete', { bg = "none", fg = colors.dark2 }) + vim.api.nvim_set_hl(0, 'DiffAdd', { bg = "#142a03" }) -- #122f2f + vim.api.nvim_set_hl(0, 'DiffChange', { bg = "#3B3307" }) + vim.api.nvim_set_hl(0, 'DiffText', { bg = "#4D520D" }) -- #2f3f5c +end +FixGruvbox() + +vim.api.nvim_create_autocmd( + "ColorScheme", + { pattern = { "gruvbox" }, callback = FixGruvbox } +) diff --git a/lua/install-plugins.lua b/lua/install-plugins.lua index 66a2d74..d2f7ba4 100644 --- a/lua/install-plugins.lua +++ b/lua/install-plugins.lua @@ -226,12 +226,6 @@ return require('packer').startup(function(use) } use 'nvim-telescope/telescope-ui-select.nvim' use 'nvim-telescope/telescope-project.nvim' - use { - 'ellisonleao/gruvbox.nvim', - config = function() - require('plugins.gruvbox') - end, - } use 'NLKNguyen/papercolor-theme' use { 'akinsho/toggleterm.nvim', @@ -447,7 +441,15 @@ return require('packer').startup(function(use) require('plugins.which-key-nvim') end } + use { + 'ellisonleao/gruvbox.nvim', + config = function() + require('plugins.gruvbox') + end, + } use 'eandrju/cellular-automaton.nvim' + use 'nyoom-engineering/oxocarbon.nvim' + use 'folke/tokyonight.nvim' -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins diff --git a/lua/plugins/gruvbox.lua b/lua/plugins/gruvbox.lua index 37040e4..a268d69 100644 --- a/lua/plugins/gruvbox.lua +++ b/lua/plugins/gruvbox.lua @@ -1,5 +1,3 @@ -local colors = require("gruvbox.palette").colors; - require("gruvbox").setup({ undercurl = true, underline = true, @@ -36,11 +34,3 @@ require("gruvbox").setup({ } }) vim.o.background = "dark" - --- TODO: how to apply this when colorscheme changes? -vim.api.nvim_set_hl(0, 'DiffDelete', { bg = "none", fg = colors.dark2 }) -vim.api.nvim_set_hl(0, 'DiffviewDiffDelete', { bg = "none", fg = colors.dark2 }) -vim.api.nvim_set_hl(0, 'DiffviewDiffAddAsDelete', { bg = "#370000" }) -vim.api.nvim_set_hl(0, 'DiffAdd', { bg = "#393400" }) -- #122f2f -vim.api.nvim_set_hl(0, 'DiffChange', { bg = "#222a36" }) -vim.api.nvim_set_hl(0, 'DiffText', { bg = "#2f3f5c" }) -- #2f3f5c