From 7a5c7ace3ac169b2898a4c7d8abec42cf9e18003 Mon Sep 17 00:00:00 2001 From: Ellison Date: Tue, 28 Jun 2022 18:22:41 -0300 Subject: [PATCH] New configuration system and more (Ref #96) (#122) * initial work * adding more tests * updates * fixing overrides in groups with links * fix bg switch and some hl groups * adding languages hl groups * adding plugins highlights * stylua * removing base module and fixing lightline * adding terminal_color_* vars * adding new screenshot --- .github/workflows/test.yml | 34 ++ Makefile | 11 + README.md | 61 ++- colors/gruvbox.lua | 5 - lua/gruvbox/base.lua | 299 ----------- lua/gruvbox/groups.lua | 650 ++++++++++++++++++++++++ lua/gruvbox/init.lua | 51 +- lua/gruvbox/languages.lua | 185 ------- lua/gruvbox/lightline.lua | 3 +- lua/gruvbox/{colors.lua => palette.lua} | 0 lua/gruvbox/plugins.lua | 274 ---------- lua/gruvbox/utils.lua | 42 -- tests/gruvbox/gruvbox_spec.lua | 113 ++++ tests/minimal_init.lua | 11 + 14 files changed, 908 insertions(+), 831 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 Makefile delete mode 100644 lua/gruvbox/base.lua create mode 100644 lua/gruvbox/groups.lua delete mode 100644 lua/gruvbox/languages.lua rename lua/gruvbox/{colors.lua => palette.lua} (100%) delete mode 100644 lua/gruvbox/plugins.lua delete mode 100644 lua/gruvbox/utils.lua create mode 100644 tests/gruvbox/gruvbox_spec.lua create mode 100644 tests/minimal_init.lua diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..1f3e2ab4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +--- +on: [push, pull_request] +name: default + +jobs: + stylua: + name: stylua + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: JohnnyMorganz/stylua-action@1.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --color always --check lua + + test: + runs-on: ubuntu-latest + strategy: + matrix: + nvim-versions: ['stable', 'nightly'] + name: test + steps: + - name: checkout + uses: actions/checkout@v2 + + - uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: ${{ matrix.nvim-versions }} + + - name: run tests + run: make test + env: + PLENARY_DIR: vendor/plenary.nvim diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..54bc1325 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +TESTS_INIT=tests/minimal_init.lua +TESTS_DIR=tests/ + +.PHONY: test + +test: + @nvim \ + --headless \ + --noplugin \ + -u ${TESTS_INIT} \ + -c "PlenaryBustedDirectory ${TESTS_DIR} { minimal_init = '${TESTS_INIT}' }" diff --git a/README.md b/README.md index e03e67a9..5d0a424a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,10 @@ A port of [gruvbox community](https://github.com/gruvbox-community/gruvbox) theme to lua with [treesitter](https://github.com/nvim-treesitter/nvim-treesitter) support! +

+ +

+ # Prerequisites Neovim 0.7.0+ @@ -26,7 +30,7 @@ Using `packer` use { "ellisonleao/gruvbox.nvim" } ``` -# Usage +# Basic Usage Inside `init.vim` @@ -38,13 +42,54 @@ colorscheme gruvbox Inside `init.lua` ```lua -vim.opt.background = "dark" -- or "light" for light mode +vim.o.background = "dark" -- or "light" for light mode vim.cmd([[colorscheme gruvbox]]) ``` # Configuration -all `g:gruvbox_` configs are the same [as the original one](https://github.com/morhetz/gruvbox/wiki/Configuration) except for `g:gruvbox_guisp_fallback` +Additional settings for gruvbox are: + +```lua +-- setup must be called before loading the colorscheme +-- Default options: +require("gruvbox").setup({ + undercurl = true, + underline = true, + bold = true, + italic = true, -- will make italic comments and special strings + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + contrast = "hard", -- can be "hard" or "light" + overrides = {}, +}) +vim.cmd("colorscheme gruvbox") +``` + +## Overriding Highlight groups + +If you don't enjoy the current color for a specific highlight group, now you can just override it in the setup. For +example: + +```lua +require("gruvbox").setup({ + overrides = { + SignColumn = {bg = "#ff9900"} + } +}) +vim.cmd("colorscheme gruvbox") +``` + +Please note that the override values must follow the attributes from the highlight group map, such as: + +- **fg** - foreground color +- **bg** - background color +- **bold** - true or false for bold font +- **italic** - true or false for italic font + +Other values can be seen in `:h synIDattr` # Additional supported plugins @@ -54,13 +99,3 @@ all `g:gruvbox_` configs are the same [as the original one](https://github.com/m - [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) And more.. - -# Screenshots - -## dark mode - -![Screenshot-from-2021-02-25-11-41-18.png](https://i.postimg.cc/66fSHrV8/Screenshot-from-2021-02-25-11-41-18.png) - -## light mode - -![Screenshot-from-2021-02-25-11-41-33.png](https://i.postimg.cc/pXVS3mkq/Screenshot-from-2021-02-25-11-41-33.png) diff --git a/colors/gruvbox.lua b/colors/gruvbox.lua index b3b4f193..f25f9842 100644 --- a/colors/gruvbox.lua +++ b/colors/gruvbox.lua @@ -1,6 +1 @@ -package.loaded["gruvbox"] = nil -package.loaded["gruvbox.base"] = nil -package.loaded["gruvbox.plugins"] = nil -package.loaded["gruvbox.lightline"] = nil -package.loaded["gruvbox.languages"] = nil require("gruvbox").load() diff --git a/lua/gruvbox/base.lua b/lua/gruvbox/base.lua deleted file mode 100644 index 38653f11..00000000 --- a/lua/gruvbox/base.lua +++ /dev/null @@ -1,299 +0,0 @@ -local colors = require("gruvbox.colors") -local utils = require("gruvbox.utils") - --- gruvbox settings handler -local settings = { - contrast_dark = "medium", - contrast_light = "medium", - bold = true, - italic = true, - undercurl = true, - underline = true, - inverse = true, - improved_strings = false, - improved_warnings = false, - invert_signs = false, - invert_selection = false, - invert_tabline = false, - italicize_comments = true, - italicize_strings = false, - invert_intend_guides = false, -} - --- setting default values -for k, val in pairs(settings) do - local key = "gruvbox_" .. k - if vim.g[key] == nil then - vim.g[key] = val - end -end - --- options (dark mode by default) -local bg0 = colors.dark0 -local bg1 = colors.dark1 -local bg2 = colors.dark2 -local bg3 = colors.dark3 -local bg4 = colors.dark4 - -local fg0 = colors.light0 -local fg1 = colors.light1 -local fg2 = colors.light2 -local fg3 = colors.light3 -local fg4 = colors.light4 - -local red = colors.bright_red -local green = colors.bright_green -local yellow = colors.bright_yellow -local blue = colors.bright_blue -local purple = colors.bright_purple -local aqua = colors.bright_aqua -local orange = colors.bright_orange -local gray = colors.gray - -local bg = vim.o.background - --- swap colors if light mode -if bg == "light" then - bg0 = colors.light0 - bg1 = colors.light1 - bg2 = colors.light2 - bg3 = colors.light3 - bg4 = colors.light4 - fg0 = colors.dark0 - fg1 = colors.dark1 - fg2 = colors.dark2 - fg3 = colors.dark3 - fg4 = colors.dark4 - red = colors.faded_red - green = colors.faded_green - yellow = colors.faded_yellow - blue = colors.faded_blue - purple = colors.faded_purple - aqua = colors.faded_aqua - orange = colors.faded_orange -end - --- handle light/dark contrast settings -local contrast = vim.g["gruvbox_contrast_" .. bg] -if contrast == "hard" then - bg0 = colors[bg .. "0_hard"] -elseif contrast == "soft" then - bg0 = colors[bg .. "0_soft"] -end - --- extending colors table with basic names for easy customization in g:gruvbox_* options -colors.bg0 = bg0 -colors.bg1 = bg1 -colors.bg2 = bg2 -colors.bg3 = bg3 -colors.bg4 = bg4 -colors.fg0 = fg0 -colors.fg1 = fg1 -colors.fg2 = fg2 -colors.fg3 = fg3 -colors.fg4 = fg4 -colors.red = red -colors.green = green -colors.yellow = yellow -colors.blue = blue -colors.purple = purple -colors.aqua = aqua -colors.orange = orange - -local hls_cursor = utils.get_color_from_var(vim.g.gruvbox_hls_cursor, orange, colors) -local hls_highlight = utils.get_color_from_var(vim.g.gruvbox_hls_highlight, yellow, colors) -local number_column = utils.get_color_from_var(vim.g.gruvbox_number_column, nil, colors) -local color_column = utils.get_color_from_var(vim.g.gruvbox_color_column, bg1, colors) -local vert_split = utils.get_color_from_var(vim.g.gruvbox_vert_split, bg0, colors) -local tabline_sel = utils.get_color_from_var(vim.g.gruvbox_tabline_sel, green, colors) -local sign_column = utils.get_color_from_var(vim.g.gruvbox_sign_column, bg1, colors) -local cursor_line = utils.get_color_from_var(vim.g.gruvbox_cursor_line, bg1, colors) - -local improved_strings_fg = fg1 -local improved_strings_bg = bg1 - -local special_string_fg = orange -local special_string_bg = bg1 - -if not vim.g.gruvbox_improved_strings then - improved_strings_fg = green - improved_strings_bg = nil - special_string_bg = nil -end - --- neovim terminal mode colors -vim.g.terminal_color_0 = bg0 -vim.g.terminal_color_8 = gray -vim.g.terminal_color_1 = colors.neutral_red -vim.g.terminal_color_9 = red -vim.g.terminal_color_2 = colors.neutral_green -vim.g.terminal_color_10 = green -vim.g.terminal_color_3 = colors.neutral_yellow -vim.g.terminal_color_11 = yellow -vim.g.terminal_color_4 = colors.neutral_blue -vim.g.terminal_color_12 = blue -vim.g.terminal_color_5 = colors.neutral_purple -vim.g.terminal_color_13 = purple -vim.g.terminal_color_6 = colors.neutral_aqua -vim.g.terminal_color_14 = aqua -vim.g.terminal_color_7 = fg4 -vim.g.terminal_color_15 = fg1 - -local base_group = { - -- Base groups - GruvboxFg0 = { fg = fg0 }, - GruvboxFg1 = { fg = fg1 }, - GruvboxFg2 = { fg = fg2 }, - GruvboxFg3 = { fg = fg3 }, - GruvboxFg4 = { fg = fg4 }, - GruvboxGray = { fg = gray }, - GruvboxBg0 = { fg = bg0 }, - GruvboxBg1 = { fg = bg1 }, - GruvboxBg2 = { fg = bg2 }, - GruvboxBg3 = { fg = bg3 }, - GruvboxBg4 = { fg = bg4 }, - - GruvboxRed = { fg = red }, - GruvboxRedBold = { fg = red, bold = vim.g.gruvbox_bold }, - GruvboxGreen = { fg = green }, - GruvboxGreenBold = { fg = green, bold = vim.g.gruvbox_bold }, - GruvboxYellow = { fg = yellow }, - GruvboxYellowBold = { fg = yellow, bold = vim.g.gruvbox_bold }, - GruvboxBlue = { fg = blue }, - GruvboxBlueBold = { fg = blue, bold = vim.g.gruvbox_bold }, - GruvboxPurple = { fg = purple }, - GruvboxPurpleBold = { fg = purple, bold = vim.g.gruvbox_bold }, - GruvboxAqua = { fg = aqua }, - GruvboxAquaBold = { fg = aqua, bold = vim.g.gruvbox_bold }, - GruvboxOrange = { fg = orange }, - GruvboxOrangeBold = { fg = orange, bold = vim.g.gruvbox_bold }, - - GruvboxRedSign = { fg = red, bg = sign_column, reverse = vim.g.gruvbox_invert_signs }, - GruvboxGreenSign = { fg = green, bg = sign_column, reverse = vim.g.gruvbox_invert_signs }, - GruvboxYellowSign = { fg = yellow, bg = sign_column, reverse = vim.g.gruvbox_invert_signs }, - GruvboxBlueSign = { fg = blue, bg = sign_column, reverse = vim.g.gruvbox_invert_signs }, - GruvboxPurpleSign = { fg = purple, bg = sign_column, reverse = vim.g.gruvbox_invert_signs }, - GruvboxAquaSign = { fg = aqua, bg = sign_column, reverse = vim.g.gruvbox_invert_signs }, - GruvboxOrangeSign = { fg = orange, bg = sign_column, reverse = vim.g.gruvbox_invert_signs }, - - GruvboxRedUnderline = { undercurl = vim.g.gruvbox_undercurl, sp = red }, - GruvboxGreenUnderline = { undercurl = vim.g.gruvbox_undercurl, sp = green }, - GruvboxYellowUnderline = { undercurl = vim.g.gruvbox_undercurl, sp = yellow }, - GruvboxBlueUnderline = { undercurl = vim.g.gruvbox_undercurl, sp = blue }, - GruvboxPurpleUnderline = { undercurl = vim.g.gruvbox_undercurl, sp = purple }, - GruvboxAquaUnderline = { undercurl = vim.g.gruvbox_undercurl, sp = aqua }, - GruvboxOrangeUnderline = { undercurl = vim.g.gruvbox_undercurl, sp = orange }, - - ColorColumn = { bg = color_column }, - Conceal = { fg = blue }, - Cursor = { reverse = vim.g.gruvbox_inverse }, - lCursor = { link = "Cursor" }, - iCursor = { link = "Cursor" }, - vCursor = { link = "Cursor" }, - CursorIM = { link = "Cursor" }, - CursorLine = { bg = cursor_line }, - CursorColumn = { link = "CursorLine" }, - Directory = { link = "GruvboxGreenBold" }, - DiffAdd = { fg = green, bg = bg0, reverse = vim.g.gruvbox_inverse }, - DiffChange = { fg = aqua, bg = bg0, reverse = vim.g.gruvbox_inverse }, - DiffDelete = { fg = red, bg = bg0, reverse = vim.g.gruvbox_inverse }, - DiffText = { fg = yellow, bg = bg0, reverse = vim.g.gruvbox_inverse }, - ErrorMsg = { fg = bg0, bg = red, bold = vim.g.gruvbox_bold }, - VertSplit = { fg = bg3, bg = vert_split }, - Folded = { fg = gray, bg = bg1, italic = vim.g.gruvbox_italic }, - FoldColumn = { fg = gray, bg = bg1 }, - SignColumn = { bg = sign_column }, - IncSearch = { fg = hls_cursor, bg = bg0, reverse = vim.g.gruvbox_inverse }, - LineNr = { fg = bg4, bg = number_column }, - CursorLineNr = { fg = yellow, bg = bg1 }, - MatchParen = { bg = bg3, bold = vim.g.gruvbox_bold }, - ModeMsg = { link = "GruvboxYellowBold" }, - MoreMsg = { link = "GruvboxYellowBold" }, - NonText = { link = "GruvboxBg2" }, - Normal = { fg = fg1, bg = bg0 }, - Pmenu = { fg = fg1, bg = bg2 }, - PmenuSel = { fg = bg2, bg = blue, bold = vim.g.gruvbox_bold }, - PmenuSbar = { bg = bg2 }, - PmenuThumb = { bg = bg4 }, - Question = { link = "GruvboxOrangeBold" }, - QuickFixLine = { bg = bg0, bold = vim.g.gruvbox_bold }, - Search = { fg = hls_highlight, bg = bg0, reverse = vim.g.gruvbox_inverse }, - CurSearch = { link = "IncSearch" }, - SpecialKey = { link = "GruvboxFg4" }, - SpellRare = { link = "GruvboxPurpleUnderline" }, - SpellBad = { link = "GruvboxRedUnderline" }, - SpellLocal = { link = "GruvboxAquaUnderline" }, - SpellCap = vim.g.gruvbox_improved_warnings and { - fg = green, - bold = vim.g.gruvbox_bold, - italic = vim.g.gruvbox_italic, - } or { link = "GruvboxBlueUnderline" }, - StatusLine = { fg = bg2, bg = fg1, reverse = vim.g.gruvbox_inverse }, - StatusLineNC = { fg = bg1, bg = fg4, reverse = vim.g.gruvbox_inverse }, - TabLineFill = { fg = bg4, bg = bg1, reverse = vim.g.gruvbox_invert_tabline }, - TabLine = { link = "TabLineFill" }, - TabLineSel = { fg = tabline_sel, bg = bg1, reverse = vim.g.gruvbox_invert_tabline }, - Title = { link = "GruvboxGreenBold" }, - Visual = { bg = bg3, reverse = vim.g.gruvbox_invert_selection }, - VisualNOS = { link = "Visual" }, - WarningMsg = { link = "GruvboxRedBold" }, - WildMenu = { fg = blue, bg = bg2, bold = vim.g.gruvbox_bold }, - Constant = { link = "GruvboxPurple" }, - Special = { fg = special_string_fg, bg = special_string_bg, italic = vim.g.gruvbox_improved_strings }, - String = { - fg = improved_strings_fg, - bg = improved_strings_bg, - italic = vim.g.gruvbox_italicize_strings, - }, - Character = { link = "GruvboxPurple" }, - Number = { link = "GruvboxPurple" }, - Boolean = { link = "GruvboxPurple" }, - Float = { link = "GruvboxPurple" }, - Identifier = { link = "GruvboxBlue" }, - Function = { link = "GruvboxGreenBold" }, - Statement = { link = "GruvboxRed" }, - Conditional = { link = "GruvboxRed" }, - Repeat = { link = "GruvboxRed" }, - Label = { link = "GruvboxRed" }, - Exception = { link = "GruvboxRed" }, - Keyword = { link = "GruvboxRed" }, - Operator = { link = "GruvboxFg1" }, - PreProc = { link = "GruvboxAqua" }, - Include = { link = "GruvboxAqua" }, - Define = { link = "GruvboxAqua" }, - Macro = { link = "GruvboxAqua" }, - PreCondit = { link = "GruvboxAqua" }, - Type = { link = "GruvboxYellow" }, - StorageClass = { link = "GruvboxOrange" }, - Structure = { link = "GruvboxAqua" }, - Typedef = { link = "GruvboxYellow" }, - SpecialChar = { link = "GruvboxRed" }, - Tag = { link = "GruvboxAquaBold" }, - Delimiter = { link = "GruvboxFg3" }, - Comment = { fg = gray, italic = vim.g.gruvbox_italicize_comments }, - Debug = { link = "GruvboxRed" }, - Underlined = { fg = blue, underline = vim.g.gruvbox_underline }, - Bold = { bold = vim.g.gruvbox_bold }, - Italic = { italic = vim.g.gruvbox_italic }, - Ignore = {}, - Error = { fg = red, bold = vim.g.gruvbox_bold, reverse = vim.g.gruvbox_inverse }, - Todo = { fg = fg0, bold = vim.g.gruvbox_bold, italic = vim.g.gruvbox_italic }, - diffAdded = { link = "GruvboxGreen" }, - diffRemoved = { link = "GruvboxRed" }, - diffChanged = { link = "GruvboxAqua" }, - diffFile = { link = "GruvboxOrange" }, - diffNewFile = { link = "GruvboxYellow" }, - diffLine = { link = "GruvboxBlue" }, - -- signature - SignatureMarkText = { link = "GruvboxBlueSign" }, - SignatureMarkerText = { link = "GruvboxPurpleSign" }, - -- gitcommit - gitcommitSelectedFile = { link = "GruvboxGreen" }, - gitcommitDiscardedFile = { link = "GruvboxRed" }, - -- checkhealth - healthError = { fg = bg0, bg = red }, - healthSuccess = { fg = bg0, bg = green }, - healthWarning = { fg = bg0, bg = yellow }, -} - -return base_group diff --git a/lua/gruvbox/groups.lua b/lua/gruvbox/groups.lua new file mode 100644 index 00000000..1d4397d3 --- /dev/null +++ b/lua/gruvbox/groups.lua @@ -0,0 +1,650 @@ +local M = {} + +local function get_base_colors(colors, contrast) + local bg = vim.o.background + local base_colors = { + -- options (dark mode by default) + bg0 = colors.dark0, + bg1 = colors.dark1, + bg2 = colors.dark2, + bg3 = colors.dark3, + bg4 = colors.dark4, + fg0 = colors.light0, + fg1 = colors.light1, + fg2 = colors.light2, + fg3 = colors.light3, + fg4 = colors.light4, + red = colors.bright_red, + green = colors.bright_green, + yellow = colors.bright_yellow, + blue = colors.bright_blue, + purple = colors.bright_purple, + aqua = colors.bright_aqua, + orange = colors.bright_orange, + gray = colors.gray, + } + + local light_colors = { + bg0 = colors.light0, + bg1 = colors.light1, + bg2 = colors.light2, + bg3 = colors.light3, + bg4 = colors.light4, + fg0 = colors.dark0, + fg1 = colors.dark1, + fg2 = colors.dark2, + fg3 = colors.dark3, + fg4 = colors.dark4, + red = colors.faded_red, + green = colors.faded_green, + yellow = colors.faded_yellow, + blue = colors.faded_blue, + purple = colors.faded_purple, + aqua = colors.faded_aqua, + orange = colors.faded_orange, + } + + -- swap colors if light mode + if bg == "light" then + base_colors = light_colors + end + + if contrast == "dark" then + base_colors.bg0 = colors[bg .. "0_hard"] + elseif contrast == "soft" then + base_colors.bg0 = colors[bg .. "0_soft"] + end + + return base_colors +end + +-- neovim terminal mode colors +local function set_terminal_colors(colors) + vim.g.terminal_color_0 = colors.bg0 + vim.g.terminal_color_8 = colors.gray + vim.g.terminal_color_1 = colors.neutral_red + vim.g.terminal_color_9 = colors.red + vim.g.terminal_color_2 = colors.neutral_green + vim.g.terminal_color_10 = colors.green + vim.g.terminal_color_3 = colors.neutral_yellow + vim.g.terminal_color_11 = colors.yellow + vim.g.terminal_color_4 = colors.neutral_blue + vim.g.terminal_color_12 = colors.blue + vim.g.terminal_color_5 = colors.neutral_purple + vim.g.terminal_color_13 = colors.purple + vim.g.terminal_color_6 = colors.neutral_aqua + vim.g.terminal_color_14 = colors.aqua + vim.g.terminal_color_7 = colors.fg4 + vim.g.terminal_color_15 = colors.fg1 +end + +M.setup = function() + local config = require("gruvbox").config + local palette = require("gruvbox.palette") + local colors = get_base_colors(palette, config.contrast) + + set_terminal_colors(colors) + + local groups = { + -- Base groups + GruvboxFg0 = { fg = colors.fg0 }, + GruvboxFg1 = { fg = colors.fg1 }, + GruvboxFg2 = { fg = colors.fg2 }, + GruvboxFg3 = { fg = colors.fg3 }, + GruvboxFg4 = { fg = colors.fg4 }, + GruvboxGray = { fg = colors.gray }, + GruvboxBg0 = { fg = colors.bg0 }, + GruvboxBg1 = { fg = colors.bg1 }, + GruvboxBg2 = { fg = colors.bg2 }, + GruvboxBg3 = { fg = colors.bg3 }, + GruvboxBg4 = { fg = colors.bg4 }, + GruvboxRed = { fg = colors.red }, + GruvboxRedBold = { fg = colors.red, bold = config.bold }, + GruvboxGreen = { fg = colors.green }, + GruvboxGreenBold = { fg = colors.green, bold = config.bold }, + GruvboxYellow = { fg = colors.yellow }, + GruvboxYellowBold = { fg = colors.yellow, bold = config.bold }, + GruvboxBlue = { fg = colors.blue }, + GruvboxBlueBold = { fg = colors.blue, bold = config.bold }, + GruvboxPurple = { fg = colors.purple }, + GruvboxPurpleBold = { fg = colors.purple, bold = config.bold }, + GruvboxAqua = { fg = colors.aqua }, + GruvboxAquaBold = { fg = colors.aqua, bold = config.bold }, + GruvboxOrange = { fg = colors.orange }, + GruvboxOrangeBold = { fg = colors.orange, bold = config.bold }, + GruvboxRedSign = { fg = colors.red, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxGreenSign = { fg = colors.green, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxYellowSign = { fg = colors.yellow, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxBlueSign = { fg = colors.blue, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxPurpleSign = { fg = colors.purple, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxAquaSign = { fg = colors.aqua, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxOrangeSign = { fg = colors.orange, bg = colors.bg1, reverse = config.invert_signs }, + GruvboxRedUnderline = { undercurl = config.undercurl, sp = colors.red }, + GruvboxGreenUnderline = { undercurl = config.undercurl, sp = colors.green }, + GruvboxYellowUnderline = { undercurl = config.undercurl, sp = colors.yellow }, + GruvboxBlueUnderline = { undercurl = config.undercurl, sp = colors.blue }, + GruvboxPurpleUnderline = { undercurl = config.undercurl, sp = colors.purple }, + GruvboxAquaUnderline = { undercurl = config.undercurl, sp = colors.aqua }, + GruvboxOrangeUnderline = { undercurl = config.undercurl, sp = colors.orange }, + ColorColumn = { bg = colors.bg1 }, + Conceal = { fg = colors.blue }, + Cursor = { reverse = config.inverse }, + lCursor = { link = "Cursor" }, + iCursor = { link = "Cursor" }, + vCursor = { link = "Cursor" }, + CursorIM = { link = "Cursor" }, + CursorLine = { bg = colors.bg1 }, + CursorColumn = { link = "CursorLine" }, + Directory = { link = "GruvboxGreenBold" }, + DiffAdd = { fg = colors.green, bg = colors.bg0, reverse = config.inverse }, + DiffChange = { fg = colors.aqua, bg = colors.bg0, reverse = config.inverse }, + DiffDelete = { fg = colors.red, bg = colors.bg0, reverse = config.inverse }, + DiffText = { fg = colors.yellow, bg = colors.bg0, reverse = config.inverse }, + ErrorMsg = { fg = colors.bg0, bg = colors.red, bold = config.bold }, + VertSplit = { fg = colors.bg3, bg = colors.bg0 }, + Folded = { fg = colors.gray, bg = colors.bg1, italic = config.italic }, + FoldColumn = { fg = colors.gray, bg = colors.bg1 }, + SignColumn = { bg = colors.bg1 }, + IncSearch = { fg = colors.hls_cursor, bg = colors.bg0, reverse = config.inverse }, + LineNr = { fg = colors.bg4 }, + CursorLineNr = { fg = colors.yellow, bg = colors.bg1 }, + MatchParen = { bg = colors.bg3, bold = config.bold }, + ModeMsg = { link = "GruvboxYellowBold" }, + MoreMsg = { link = "GruvboxYellowBold" }, + NonText = { link = "GruvboxBg2" }, + Normal = { fg = colors.fg1, bg = colors.bg0 }, + Pmenu = { fg = colors.fg1, bg = colors.bg2 }, + PmenuSel = { fg = colors.bg2, bg = colors.blue, bold = config.bold }, + PmenuSbar = { bg = colors.bg2 }, + PmenuThumb = { bg = colors.bg4 }, + Question = { link = "GruvboxOrangeBold" }, + QuickFixLine = { bg = colors.bg0, bold = config.bold }, + Search = { fg = colors.yellow, bg = colors.bg0, reverse = config.inverse }, + CurSearch = { link = "IncSearch" }, + SpecialKey = { link = "GruvboxFg4" }, + SpellRare = { link = "GruvboxPurpleUnderline" }, + SpellBad = { link = "GruvboxRedUnderline" }, + SpellLocal = { link = "GruvboxAquaUnderline" }, + SpellCap = { link = "GruvboxBlueUnderline" }, + StatusLine = { fg = colors.bg2, bg = colors.fg1, reverse = config.inverse }, + StatusLineNC = { fg = colors.bg1, bg = colors.fg4, reverse = config.inverse }, + TabLineFill = { fg = colors.bg4, bg = colors.bg1, reverse = config.invert_tabline }, + TabLine = { link = "TabLineFill" }, + TabLineSel = { fg = colors.green, bg = colors.bg1, reverse = config.invert_tabline }, + Title = { link = "GruvboxGreenBold" }, + Visual = { bg = colors.bg3, reverse = config.invert_selection }, + VisualNOS = { link = "Visual" }, + WarningMsg = { link = "GruvboxRedBold" }, + WildMenu = { fg = colors.blue, bg = colors.bg2, bold = config.bold }, + Constant = { link = "GruvboxPurple" }, + Special = { link = "GruvboxOrange" }, + String = { fg = colors.green, italic = config.italic }, + Character = { link = "GruvboxPurple" }, + Number = { link = "GruvboxPurple" }, + Boolean = { link = "GruvboxPurple" }, + Float = { link = "GruvboxPurple" }, + Identifier = { link = "GruvboxBlue" }, + Function = { link = "GruvboxGreenBold" }, + Statement = { link = "GruvboxRed" }, + Conditional = { link = "GruvboxRed" }, + Repeat = { link = "GruvboxRed" }, + Label = { link = "GruvboxRed" }, + Exception = { link = "GruvboxRed" }, + Keyword = { link = "GruvboxRed" }, + Operator = { link = "GruvboxFg1" }, + PreProc = { link = "GruvboxAqua" }, + Include = { link = "GruvboxAqua" }, + Define = { link = "GruvboxAqua" }, + Macro = { link = "GruvboxAqua" }, + PreCondit = { link = "GruvboxAqua" }, + Type = { link = "GruvboxYellow" }, + StorageClass = { link = "GruvboxOrange" }, + Structure = { link = "GruvboxAqua" }, + Typedef = { link = "GruvboxYellow" }, + SpecialChar = { link = "GruvboxRed" }, + Tag = { link = "GruvboxAquaBold" }, + Delimiter = { link = "GruvboxFg3" }, + Comment = { fg = colors.gray, italic = config.italic }, + Debug = { link = "GruvboxRed" }, + Underlined = { fg = colors.blue, underline = config.underline }, + Bold = { bold = config.bold }, + Italic = { italic = config.italic }, + Ignore = {}, + Error = { fg = colors.red, bold = config.bold, reverse = config.inverse }, + Todo = { fg = colors.fg0, bold = config.bold, italic = config.italic }, + diffAdded = { link = "GruvboxGreen" }, + diffRemoved = { link = "GruvboxRed" }, + diffChanged = { link = "GruvboxAqua" }, + diffFile = { link = "GruvboxOrange" }, + diffNewFile = { link = "GruvboxYellow" }, + diffLine = { link = "GruvboxBlue" }, + -- signature + SignatureMarkText = { link = "GruvboxBlueSign" }, + SignatureMarkerText = { link = "GruvboxPurpleSign" }, + -- gitcommit + gitcommitSelectedFile = { link = "GruvboxGreen" }, + gitcommitDiscardedFile = { link = "GruvboxRed" }, + -- checkhealth + healthError = { fg = colors.bg0, bg = colors.red }, + healthSuccess = { fg = colors.bg0, bg = colors.green }, + healthWarning = { fg = colors.bg0, bg = colors.yellow }, + -- xml + xmlTag = { link = "GruvboxAquaBold" }, + xmlEndTag = { link = "GruvboxAquaBold" }, + xmlTagName = { link = "GruvboxBlue" }, + xmlEqual = { link = "GruvboxBlue" }, + docbkKeyword = { link = "GruvboxAquaBold" }, + xmlDocTypeDecl = { link = "GruvboxGray" }, + xmlDocTypeKeyword = { link = "GruvboxPurple" }, + xmlCdataStart = { link = "GruvboxGray" }, + xmlCdataCdata = { link = "GruvboxPurple" }, + dtdFunction = { link = "GruvboxGray" }, + dtdTagName = { link = "GruvboxPurple" }, + xmlAttrib = { link = "GruvboxOrange" }, + xmlProcessingDelim = { link = "GruvboxGray" }, + dtdParamEntityPunct = { link = "GruvboxGray" }, + dtdParamEntityDPunct = { link = "GruvboxGray" }, + xmlAttribPunct = { link = "GruvboxGray" }, + xmlEntity = { link = "GruvboxRed" }, + xmlEntityPunct = { link = "GruvboxRed" }, + -- purescript + purescriptModuleKeyword = { link = "GruvboxAqua" }, + purescriptModuleName = { link = "GruvboxFg1" }, + purescriptWhere = { link = "GruvboxAqua" }, + purescriptDelimiter = { link = "GruvboxFg4" }, + purescriptType = { link = "GruvboxFg1" }, + purescriptImportKeyword = { link = "GruvboxAqua" }, + purescriptHidingKeyword = { link = "GruvboxAqua" }, + purescriptAsKeyword = { link = "GruvboxAqua" }, + purescriptStructure = { link = "GruvboxAqua" }, + purescriptOperator = { link = "GruvboxBlue" }, + purescriptTypeVar = { link = "GruvboxFg1" }, + purescriptConstructor = { link = "GruvboxFg1" }, + purescriptFunction = { link = "GruvboxFg1" }, + purescriptConditional = { link = "GruvboxOrange" }, + purescriptBacktick = { link = "GruvboxOrange" }, + -- coffescript + coffeeExtendedOp = { link = "GruvboxFg3" }, + coffeeSpecialOp = { link = "GruvboxFg3" }, + coffeeCurly = { link = "GruvboxOrange" }, + coffeeParen = { link = "GruvboxFg3" }, + coffeeBracket = { link = "GruvboxOrange" }, + -- objc + objcTypeModifier = { link = "GruvboxRed" }, + objcDirective = { link = "GruvboxBlue" }, + -- moonscript + moonSpecialOp = { link = "GruvboxFg3" }, + moonExtendedOp = { link = "GruvboxFg3" }, + moonFunction = { link = "GruvboxFg3" }, + moonObject = { link = "GruvboxYellow" }, + -- elixir + elixirDocString = { link = "Comment" }, + elixirStringDelimiter = { link = "GruvboxGreen" }, + elixirInterpolationDelimiter = { link = "GruvboxAqua" }, + elixirModuleDeclaration = { link = "GruvboxYellow" }, + -- markdown + markdownItalic = { fg = colors.fg3, bold = config.italic }, + markdownBold = { fg = colors.fg3, bold = config.bold }, + markdownBoldItalic = { fg = colors.fg3, bold = config.bold, italic = config.italic }, + markdownH1 = { link = "GruvboxGreenBold" }, + markdownH2 = { link = "markdownH1" }, + markdownH3 = { link = "GruvboxYellowBold" }, + markdownH4 = { link = "markdownH3" }, + markdownH5 = { link = "GruvboxYellow" }, + markdownH6 = { link = "markdownH5" }, + markdownCode = { link = "GruvboxAqua" }, + markdownCodeBlock = { link = "GruvboxAqua" }, + markdownCodeDelimiter = { link = "GruvboxAqua" }, + markdownBlockquote = { link = "GruvboxGray" }, + markdownListMarker = { link = "GruvboxGray" }, + markdownOrderedListMarker = { link = "GruvboxGray" }, + markdownRule = { link = "GruvboxGray" }, + markdownHeadingRule = { link = "GruvboxGray" }, + markdownUrlDelimiter = { link = "GruvboxFg3" }, + markdownLinkDelimiter = { link = "GruvboxFg3" }, + markdownLinkTextDelimiter = { link = "GruvboxFg3" }, + markdownHeadingDelimiter = { link = "GruvboxOrange" }, + markdownUrl = { link = "GruvboxPurple" }, + markdownUrlTitleDelimiter = { link = "GruvboxGreen" }, + markdownLinkText = { fg = colors.gray, underline = config.underline }, + markdownIdDeclaration = { link = "markdownLinkText" }, + -- haskell + haskellType = { link = "GruvboxBlue" }, + haskellIdentifier = { link = "GruvboxAqua" }, + haskellSeparator = { link = "GruvboxFg4" }, + haskellDelimiter = { link = "GruvboxOrange" }, + haskellOperators = { link = "GruvboxPurple" }, + haskellBacktick = { link = "GruvboxOrange" }, + haskellStatement = { link = "GruvboxPurple" }, + haskellConditional = { link = "GruvboxPurple" }, + haskellLet = { link = "GruvboxRed" }, + haskellDefault = { link = "GruvboxRed" }, + haskellWhere = { link = "GruvboxRed" }, + haskellBottom = { link = "GruvboxRedBold" }, + haskellImportKeywords = { link = "GruvboxPurpleBold" }, + haskellDeclKeyword = { link = "GruvboxOrange" }, + haskellDecl = { link = "GruvboxOrange" }, + haskellDeriving = { link = "GruvboxPurple" }, + haskellAssocType = { link = "GruvboxAqua" }, + haskellNumber = { link = "GruvboxAqua" }, + haskellPragma = { link = "GruvboxRedBold" }, + haskellTH = { link = "GruvboxAquaBold" }, + haskellForeignKeywords = { link = "GruvboxGreen" }, + haskellKeyword = { link = "GruvboxRed" }, + haskellFloat = { link = "GruvboxAqua" }, + haskellInfix = { link = "GruvboxPurple" }, + haskellQuote = { link = "GruvboxGreenBold" }, + haskellShebang = { link = "GruvboxYellowBold" }, + haskellLiquid = { link = "GruvboxPurpleBold" }, + haskellQuasiQuoted = { link = "GruvboxBlueBold" }, + haskellRecursiveDo = { link = "GruvboxPurple" }, + haskellQuotedType = { link = "GruvboxRed" }, + haskellPreProc = { link = "GruvboxFg4" }, + haskellTypeRoles = { link = "GruvboxRedBold" }, + haskellTypeForall = { link = "GruvboxRed" }, + haskellPatternKeyword = { link = "GruvboxBlue" }, + -- html + htmlTag = { link = "GruvboxAquaBold" }, + htmlEndTag = { link = "GruvboxAquaBold" }, + htmlTagName = { link = "GruvboxBlue" }, + htmlArg = { link = "GruvboxOrange" }, + htmlTagN = { link = "GruvboxFg1" }, + htmlSpecialTagName = { link = "GruvboxBlue" }, + htmlLink = { fg = colors.fg4, underline = config.underline }, + htmlSpecialChar = { link = "GruvboxRed" }, + htmlBold = { fg = colors.fg0, bg = colors.bg0, bold = config.bold }, + htmlBoldUnderline = { fg = colors.fg0, bg = colors.bg0, bold = config.bold, underline = config.underline }, + htmlBoldItalic = { fg = colors.fg0, bg = colors.bg0, bold = config.bold, italic = config.italic }, + htmlBoldUnderlineItalic = { + fg = colors.fg0, + bg = colors.bg0, + bold = config.bold, + italic = config.italic, + underline = config.underline, + }, + htmlUnderline = { fg = colors.fg0, bg = colors.bg0, underline = config.underline }, + htmlUnderlineItalic = { + fg = colors.fg0, + bg = colors.bg0, + italic = config.italic, + underline = config.underline, + }, + htmlItalic = { fg = colors.fg0, bg = colors.bg0, bold = config.italic }, + -- netrw + netrwDir = { link = "GruvboxAqua" }, + netrwClassify = { link = "GruvboxAqua" }, + netrwLink = { link = "GruvboxGray" }, + netrwSymLink = { link = "GruvboxFg1" }, + netrwExe = { link = "GruvboxYellow" }, + netrwComment = { link = "GruvboxGray" }, + netrwList = { link = "GruvboxBlue" }, + netrwHelpCmd = { link = "GruvboxAqua" }, + netrwCmdSep = { link = "GruvboxFg3" }, + netrwVersion = { link = "GruvboxGreen" }, + -- nvim-treesitter + TSNone = {}, + TSError = {}, + TSTitle = { link = "Title" }, + TSLiteral = { link = "String" }, + TSURI = { link = "Underlined" }, + TSVariable = { link = "GruvboxFg1" }, + TSPunctDelimiter = { link = "Delimiter" }, + TSPunctBracket = { link = "Delimiter" }, + TSPunctSpecial = { link = "Delimiter" }, + TSConstant = { link = "Constant" }, + TSConstBuiltin = { link = "Special" }, + TSConstMacro = { link = "Define" }, + TSString = { link = "String" }, + TSStringRegex = { link = "String" }, + TSStringEscape = { link = "SpecialChar" }, + TSCharacter = { link = "Character" }, + TSNumber = { link = "Number" }, + TSBoolean = { link = "Boolean" }, + TSFloat = { link = "Float" }, + TSFunction = { link = "Function" }, + TSFuncBuiltin = { link = "Special" }, + TSFuncMacro = { link = "Macro" }, + TSParameter = { link = "Identifier" }, + TSParameterReference = { link = "TSParameter" }, + TSMethod = { link = "Function" }, + TSField = { link = "Identifier" }, + TSProperty = { link = "Identifier" }, + TSConstructor = { link = "Special" }, + TSAnnotation = { link = "PreProc" }, + TSAttribute = { link = "PreProc" }, + TSNamespace = { link = "Include" }, + TSConditional = { link = "Conditional" }, + TSRepeat = { link = "Repeat" }, + TSLabel = { link = "Label" }, + TSOperator = { link = "Operator" }, + TSKeyword = { link = "Keyword" }, + TSKeywordFunction = { link = "Keyword" }, + TSKeywordOperator = { link = "GruvboxRed" }, + TSException = { link = "Exception" }, + TSType = { link = "Type" }, + TSTypeBuiltin = { link = "Type" }, + TSInclude = { link = "Include" }, + TSVariableBuiltin = { link = "Special" }, + TSText = { link = "TSNone" }, + TSStrong = { bold = config.bold }, + TSEmphasis = { italic = config.italic }, + TSUnderline = { underline = config.underline }, + TSComment = { link = "Comment" }, + TSStructure = { link = "GruvboxOrange" }, + TSTag = { link = "GruvboxOrange" }, + TSTagDelimiter = { link = "GruvboxGreen" }, + -- telescope.nvim + TelescopeSelection = { link = "GruvboxOrangeBold" }, + TelescopeSlectionCaret = { link = "GruvboxRed" }, + TelescopeMultiSelection = { link = "GruvboxGray" }, + TelescopeNormal = { link = "GruvboxFg1" }, + TelescopeBorder = { link = "TelescopeNormal" }, + TelescopePromptBorder = { link = "TelescopeNormal" }, + TelescopeResultsBorder = { link = "TelescopeNormal" }, + TelescopePreviewBorder = { link = "TelescopeNormal" }, + TelescopeMatching = { link = "GruvboxBlue" }, + TelescopePromptPrefix = { link = "GruvboxRed" }, + TelescopePrompt = { link = "TelescopeNormal" }, + -- lspsaga.nvim + LspSagaDiagnosticBorder = { link = "NormalNC" }, + LspSagaDiagnosticHeader = { link = "GruvboxRed" }, + LspSagaDiagnosticTruncateLine = { link = "NormalNC" }, + LspFloatWinBorder = { link = "NormalNC" }, + LspSagaBorderTitle = { link = "Title" }, + TargetWord = { link = "Error" }, + ReferencesCount = { link = "Title" }, + ReferencesIcon = { link = "Special" }, + DefinitionCount = { link = "Title" }, + TargetFileName = { link = "Comment" }, + DefinitionIcon = { link = "Special" }, + ProviderTruncateLine = { link = "NormalNC" }, + SagaShadow = { link = "GruvboxBg0" }, + LspSagaFinderSelection = { link = "Search" }, + DiagnosticTruncateLine = { link = "NormalNC" }, + DiagnosticWarning = { link = "DiagnosticWarn" }, + DiagnosticInformation = { link = "DiagnosticInfo" }, + DefinitionPreviewTitle = { link = "Title" }, + LspSagaShTruncateLine = { link = "NormalNC" }, + LspSagaDocTruncateLine = { link = "NormalNC" }, + LineDiagTuncateLine = { link = "NormalNC" }, + LspSagaCodeActionTitle = { link = "Title" }, + LspSagaCodeActionTruncateLine = { link = "NormalNC" }, + LspSagaCodeActionContent = { link = "Normal" }, + LspSagaRenamePromptPrefix = { link = "GruvboxFg2" }, + LspSagaRenameBorder = { bold = config.bold }, + LspSagaHoverBorder = { bold = config.bold }, + LspSagaSignatureHelpBorder = { bold = config.bold }, + LspSagaCodeActionBorder = { bold = config.bold }, + LspSagaAutoPreview = {}, + LspSagaDefPreviewBorder = { bold = config.bold }, + LspLinesDiagBorder = { bold = config.bold }, + -- vim-startify + StartifyBracket = { link = "GruvboxFg3" }, + StartifyFile = { link = "GruvboxFg1" }, + StartifyNumber = { link = "GruvboxBlue" }, + StartifyPath = { link = "GruvboxGray" }, + StartifySlash = { link = "GruvboxGray" }, + StartifySection = { link = "GruvboxYellow" }, + StartifySpecial = { link = "GruvboxBg2" }, + StartifyHeader = { link = "GruvboxOrange" }, + StartifyFooter = { link = "GruvboxBg2" }, + StartifyVar = { link = "StartifyPath" }, + StartifySelect = { link = "Title" }, + -- vim-signify + SignifySignAdd = { link = "GruvboxGreenSign" }, + SignifySignChange = { link = "GruvboxAquaSign" }, + SignifySignDelete = { link = "GruvboxRedSign" }, + -- syntastic + SyntasticError = { link = "GruvboxRedUnderline" }, + SyntasticWarning = { link = "GruvboxYellowUnderline" }, + SyntasticErrorSign = { link = "GruvboxRedSign" }, + SyntasticWarningSign = { link = "GruvboxYellowSign" }, + -- termdebug + debugPC = { bg = colors.faded_blue }, + debugBreakpoint = { link = "GruvboxRedSign" }, + -- vim-dirvish + DirvishPathTail = { link = "GruvboxAqua" }, + DirvishArg = { link = "GruvboxYellow" }, + -- nerdtree + NERDTreeDir = { link = "GruvboxAqua" }, + NERDTreeDirSlash = { link = "GruvboxAqua" }, + NERDTreeOpenable = { link = "GruvboxOrange" }, + NERDTreeClosable = { link = "GruvboxOrange" }, + NERDTreeFile = { link = "GruvboxFg1" }, + NERDTreeExecFile = { link = "GruvboxYellow" }, + NERDTreeUp = { link = "GruvboxGray" }, + NERDTreeCWD = { link = "GruvboxGreen" }, + NERDTreeHelp = { link = "GruvboxFg1" }, + NERDTreeToggleOn = { link = "GruvboxGreen" }, + NERDTreeToggleOff = { link = "GruvboxRed" }, + -- coc.nvim + CocErrorSign = { link = "GruvboxRedSign" }, + CocWarningSign = { link = "GruvboxOrangeSign" }, + CocInfoSign = { link = "GruvboxBlueSign" }, + CocHintSign = { link = "GruvboxAquaSign" }, + CocErrorFloat = { link = "GruvboxRed" }, + CocWarningFloat = { link = "GruvboxOrange" }, + CocInfoFloat = { link = "GruvboxBlue" }, + CocHintFloat = { link = "GruvboxAqua" }, + CocDiagnosticsError = { link = "GruvboxRed" }, + CocDiagnosticsWarning = { link = "GruvboxOrange" }, + CocDiagnosticsInfo = { link = "GruvboxBlue" }, + CocDiagnosticsHint = { link = "GruvboxAqua" }, + CocSelectedText = { link = "GruvboxRed" }, + CocCodeLens = { link = "GruvboxGray" }, + CocErrorHighlight = { link = "GruvboxRedUnderline" }, + CocWarningHighlight = { link = "GruvboxOrangeUnderline" }, + CocInfoHighlight = { link = "GruvboxBlueUnderline" }, + CocHintHighlight = { link = "GruvboxAquaUnderline" }, + -- ale.vim + ALEError = { link = "GruvboxRedUnderline" }, + ALEWarning = { link = "GruvboxYellowUnderline" }, + ALEInfo = { link = "GruvboxBlueUnderline" }, + ALEErrorSign = { link = "GruvboxRedSign" }, + ALEWarningSign = { link = "GruvboxYellowSign" }, + ALEInfoSign = { link = "GruvboxBlueSign" }, + ALEVirtualTextError = { link = "GruvboxRed" }, + ALEVirtualTextWarning = { link = "GruvboxYellow" }, + ALEVirtualTextInfo = { link = "GruvboxBlue" }, + -- vim-buftabline + BufTabLineCurrent = { link = "TabLineSel" }, + BufTabLineActive = { link = "PmenuSel" }, + BufTabLineHidden = { link = "TabLine" }, + BufTabLineFill = { link = "TabLineFill" }, + BufTabLineModifiedCurrent = { link = "BufTabLineCurrent" }, + BufTabLineModifiedActive = { link = "BufTabLineActive" }, + BufTabLineModifiedHidden = { link = "BufTabLineHidden" }, + -- ctrlP + CtrlPMatch = { link = "Identifier" }, + CtrlPNoEntries = { link = "Error" }, + CtrlPPrtBase = { link = "Comment" }, + CtrlPPrtCursor = { link = "Constant" }, + CtrlPLinePre = { fg = colors.bg2 }, + CtrlPMode1 = { link = "Character" }, + CtrlPMode2 = { link = "LineNr" }, + CtrlPStats = { link = "Function" }, + -- fzf.vim + Fzf1 = { fg = colors.blue, bg = colors.bg1 }, + Fzf2 = { fg = colors.orange, bg = colors.bg1 }, + Fzf3 = { fg = colors.fg4, bg = colors.bg1 }, + ShowMarksHLl = { link = "GruvboxBlueSign" }, + ShowMarksHLu = { link = "GruvboxBlueSign" }, + ShowMarksHLo = { link = "GruvboxBlueSign" }, + ShowMarksHLm = { link = "GruvboxBlueSign" }, + -- git-gutter + GitGutterAdd = { link = "GruvboxGreenSign" }, + GitGutterChange = { link = "GruvboxAquaSign" }, + GitGutterDelete = { link = "GruvboxRedSign" }, + GitGutterChangeDelete = { link = "GruvboxAquaSign" }, + -- gitsigns.nvim + GitSignsAdd = { link = "GruvboxGreenSign" }, + GitSignsChange = { link = "GruvboxOrangeSign" }, + GitSignsDelete = { link = "GruvboxRedSign" }, + GitSignsCurrentLineBlame = { link = "NonText" }, + -- nvim-cmp + CmpItemAbbr = { link = "GruvboxFg0" }, + CmpItemAbbrDeprecated = { link = "GruvboxFg0" }, + CmpItemAbbrMatch = { link = "GruvboxBlue" }, + CmpItemAbbrMatchFuzzy = { underline = config.underline, fg = colors.aqua }, + CmpItemKind = { link = "GruvboxOrange" }, + CmpItemKindClass = { link = "GruvboxGreen" }, + CmpItemKindConstructor = { link = "GruvboxGreen" }, + CmpItemKindField = { link = "GruvboxAqua" }, + CmpItemKindFile = { link = "GruvboxOrange" }, + CmpItemKindFolder = { link = "GruvboxOrange" }, + CmpItemKindFunction = { link = "GruvboxPurple" }, + CmpItemKindInterface = { link = "GruvboxGreen" }, + CmpItemKindKeyword = { link = "Keyword" }, + CmpItemKindMethod = { link = "GruvboxPurple" }, + CmpItemKindSnippet = { link = "GruvboxYellow" }, + CmpItemKindText = { link = "GruvboxFg0" }, + CmpItemKindValue = { link = "GruvboxOrange" }, + CmpItemKindVariable = { link = "GruvboxBlue" }, + CmpItemMenu = { link = "GruvboxGray" }, + -- LSP + LspCodeLens = { link = "GruvboxGray" }, + LspReferenceRead = { bg = colors.bg2, underline = config.underline }, + LspReferenceText = { bg = colors.bg2, underline = config.underline }, + LspReferenceWrite = { bg = colors.bg2, underline = config.underline }, + -- Diagnostic + DiagnosticError = { link = "GruvboxRed" }, + DiagnosticSignError = { link = "GruvboxRedSign" }, + DiagnosticUnderlineError = { link = "GruvboxRedUnderline" }, + DiagnosticWarn = { link = "GruvboxYellow" }, + DiagnosticSignWarn = { link = "GruvboxYellowSign" }, + DiagnosticUnderlineWarn = { link = "GruvboxYellowUnderline" }, + DiagnosticInfo = { link = "GruvboxBlue" }, + DiagnosticSignInfo = { link = "GruvboxBlueSign" }, + DiagnosticUnderlineInfo = { link = "GruvboxBlueUnderline" }, + DiagnosticHint = { link = "GruvboxAqua" }, + DiagnosticSignHint = { link = "GruvboxAquaSign" }, + DiagnosticUnderlineHint = { link = "GruvboxAquaUnderline" }, + DiagnosticFloatingError = { link = "GruvboxRed" }, + DiagnosticFloatingWarn = { link = "GruvboxOrange" }, + DiagnosticFloatingInfo = { link = "GruvboxBlue" }, + DiagnosticFloatingHint = { link = "GruvboxAqua" }, + DiagnosticVirtualTextError = { link = "GruvboxRed" }, + DiagnosticVirtualTextWarn = { link = "GruvboxYellow" }, + DiagnosticVirtualTextInfo = { link = "GruvboxBlue" }, + DiagnosticVirtualTextHint = { link = "GruvboxAqua" }, + -- mail.vim + mailQuoted1 = { link = "GruvboxAqua" }, + mailQuoted2 = { link = "GruvboxPurple" }, + mailQuoted3 = { link = "GruvboxYellow" }, + mailQuoted4 = { link = "GruvboxGreen" }, + mailQuoted5 = { link = "GruvboxRed" }, + mailQuoted6 = { link = "GruvboxOrange" }, + mailSignature = { link = "Comment" }, + } + + for group, hl in pairs(config.overrides) do + if groups[group] and not vim.tbl_isempty(hl) then + groups[group].link = nil + end + groups[group] = vim.tbl_extend("force", groups[group] or {}, hl) + end + + return groups +end + +return M diff --git a/lua/gruvbox/init.lua b/lua/gruvbox/init.lua index dd324fa6..bdaeadf1 100644 --- a/lua/gruvbox/init.lua +++ b/lua/gruvbox/init.lua @@ -1,27 +1,54 @@ -local base = require("gruvbox.base") -local plugins = require("gruvbox.plugins") -local languages = require("gruvbox.languages") -local utils = require("gruvbox.utils") +local M = {} -local specs = { base, languages, plugins } -local spec = utils.merge(specs) +local function add_highlights(hls) + for group, settings in pairs(hls) do + -- we need https://github.com/neovim/neovim/commit/9aba2043351c79cd9bc8fa7b229ee7629ba178f0 in stable version first + -- in order to get Normal using nvim_set_hl + if group == "Normal" then + vim.cmd(string.format("hi! Normal guifg=%s guibg=%s", settings.fg, settings.bg)) + else + vim.api.nvim_set_hl(0, group, settings) + end + end +end + +-- default configs +M.config = { + undercurl = true, + underline = true, + bold = true, + italic = true, -- will make italic comments and special strings + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + contrast = "hard", + overrides = {}, +} + +function M.setup(config) + M.config = vim.tbl_extend("force", M.config, config or {}) +end -local M = {} M.load = function() if vim.version().minor < 7 then - vim.api.nvim_err_writeln("gruvbox.nvim: you must use neovim 0.7 or higher") + vim.notify_once("gruvbox.nvim: you must use neovim 0.7 or higher") return end -- reset colors - vim.cmd("hi clear") - if vim.fn.exists("syntax_on") then - vim.cmd("syntax reset") + if vim.g.colors_name then + vim.cmd("hi clear") end vim.g.colors_name = "gruvbox" vim.o.termguicolors = true - utils.add_highlights(spec) + + local groups = require("gruvbox.groups").setup() + + add_highlights(groups) + + vim.cmd("colorscheme gruvbox") end return M diff --git a/lua/gruvbox/languages.lua b/lua/gruvbox/languages.lua deleted file mode 100644 index eb1c8407..00000000 --- a/lua/gruvbox/languages.lua +++ /dev/null @@ -1,185 +0,0 @@ --- language specific higlights -local base = require("gruvbox.base") -local utils = require("gruvbox.utils") -local colors = require("gruvbox.colors") - --- xml -local xml = { - xmlTag = base.GruvboxAquaBold, - xmlEndTag = base.GruvboxAquaBold, - xmlTagName = base.GruvboxBlue, - xmlEqual = base.GruvboxBlue, - docbkKeyword = base.GruvboxAquaBold, - xmlDocTypeDecl = base.GruvboxGray, - xmlDocTypeKeyword = base.GruvboxPurple, - xmlCdataStart = base.GruvboxGray, - xmlCdataCdata = base.GruvboxPurple, - dtdFunction = base.GruvboxGray, - dtdTagName = base.GruvboxPurple, - xmlAttrib = base.GruvboxOrange, - xmlProcessingDelim = base.GruvboxGray, - dtdParamEntityPunct = base.GruvboxGray, - dtdParamEntityDPunct = base.GruvboxGray, - xmlAttribPunct = base.GruvboxGray, - xmlEntity = base.GruvboxRed, - xmlEntityPunct = base.GruvboxRed, -} - -local purescript = { - purescriptModuleKeyword = base.GruvboxAqua, - purescriptModuleName = base.GruvboxFg1, - purescriptWhere = base.GruvboxAqua, - purescriptDelimiter = base.GruvboxFg4, - purescriptType = base.GruvboxFg1, - purescriptImportKeyword = base.GruvboxAqua, - purescriptHidingKeyword = base.GruvboxAqua, - purescriptAsKeyword = base.GruvboxAqua, - purescriptStructure = base.GruvboxAqua, - purescriptOperator = base.GruvboxBlue, - purescriptTypeVar = base.GruvboxFg1, - purescriptConstructor = base.GruvboxFg1, - purescriptFunction = base.GruvboxFg1, - purescriptConditional = base.GruvboxOrange, - purescriptBacktick = base.GruvboxOrange, -} - -local coffeescript = { - coffeeExtendedOp = base.GruvboxFg3, - coffeeSpecialOp = base.GruvboxFg3, - coffeeCurly = base.GruvboxOrange, - coffeeParen = base.GruvboxFg3, - coffeeBracket = base.GruvboxOrange, -} - -local objc = { objcTypeModifier = base.GruvboxRed, objcDirective = base.GruvboxBlue } - -local moonscript = { - moonSpecialOp = base.GruvboxFg3, - moonExtendedOp = base.GruvboxFg3, - moonFunction = base.GruvboxFg3, - moonObject = base.GruvboxYellow, -} - -local elixir = { - elixirDocString = base.Comment, - elixirStringDelimiter = base.GruvboxGreen, - elixirInterpolationDelimiter = base.GruvboxAqua, - elixirModuleDeclaration = base.GruvboxYellow, -} - -local markdown = { - markdownItalic = { fg = base.GruvboxFg3.fg, bold = vim.g.gruvbox_italic }, - markdownBold = { fg = base.GruvboxFg3.fg, bold = vim.g.gruvbox_bold }, - markdownBoldItalic = { - fg = base.GruvboxFg3.fg, - bold = vim.g.gruvbox_bold, - italic = vim.g.gruvbox_italic, - }, - markdownH1 = base.GruvboxGreenBold, - markdownH2 = { link = "markdownH1" }, - markdownH3 = base.GruvboxYellowBold, - markdownH4 = { link = "markdownH3" }, - markdownH5 = base.GruvboxYellow, - markdownH6 = { link = "markdownH5" }, - markdownCode = base.GruvboxAqua, - markdownCodeBlock = base.GruvboxAqua, - markdownCodeDelimiter = base.GruvboxAqua, - markdownBlockquote = base.GruvboxGray, - markdownListMarker = base.GruvboxGray, - markdownOrderedListMarker = base.GruvboxGray, - markdownRule = base.GruvboxGray, - markdownHeadingRule = base.GruvboxGray, - markdownUrlDelimiter = base.GruvboxFg3, - markdownLinkDelimiter = base.GruvboxFg3, - markdownLinkTextDelimiter = base.GruvboxFg3, - markdownHeadingDelimiter = base.GruvboxOrange, - markdownUrl = base.GruvboxPurple, - markdownUrlTitleDelimiter = base.GruvboxGreen, - markdownLinkText = { fg = base.GruvboxGray.fg, underline = vim.g.gruvbox_underline }, - markdownIdDeclaration = { link = "markdownLinkText" }, -} - -local haskell = { - haskellType = base.GruvboxBlue, - haskellIdentifier = base.GruvboxAqua, - haskellSeparator = base.GruvboxFg4, - haskellDelimiter = base.GruvboxOrange, - haskellOperators = base.GruvboxPurple, - haskellBacktick = base.GruvboxOrange, - haskellStatement = base.GruvboxPurple, - haskellConditional = base.GruvboxPurple, - haskellLet = base.GruvboxRed, - haskellDefault = base.GruvboxRed, - haskellWhere = base.GruvboxRed, - haskellBottom = base.GruvboxRedBold, - haskellImportKeywords = base.GruvboxPurpleBold, - haskellDeclKeyword = base.GruvboxOrange, - haskellDecl = base.GruvboxOrange, - haskellDeriving = base.GruvboxPurple, - haskellAssocType = base.GruvboxAqua, - haskellNumber = base.GruvboxAqua, - haskellPragma = base.GruvboxRedBold, - haskellTH = base.GruvboxAquaBold, - haskellForeignKeywords = base.GruvboxGreen, - haskellKeyword = base.GruvboxRed, - haskellFloat = base.GruvboxAqua, - haskellInfix = base.GruvboxPurple, - haskellQuote = base.GruvboxGreenBold, - haskellShebang = base.GruvboxYellowBold, - haskellLiquid = base.GruvboxPurpleBold, - haskellQuasiQuoted = base.GruvboxBlueBold, - haskellRecursiveDo = base.GruvboxPurple, - haskellQuotedType = base.GruvboxRed, - haskellPreProc = base.GruvboxFg4, - haskellTypeRoles = base.GruvboxRedBold, - haskellTypeForall = base.GruvboxRed, - haskellPatternKeyword = base.GruvboxBlue, -} - -local html = { - htmlTag = base.GruvboxAquaBold, - htmlEndTag = base.GruvboxAquaBold, - htmlTagName = base.GruvboxBlue, - htmlArg = base.GruvboxOrange, - htmlTagN = base.GruvboxFg1, - htmlSpecialTagName = base.GruvboxBlue, - htmlLink = { fg = colors.fg4, underline = vim.g.gruvbox_underline }, - htmlSpecialChar = { link = "GruvboxRed" }, - htmlBold = { fg = colors.fg0, bg = colors.bg0, bold = vim.g.gruvbox_bold }, - htmlBoldUnderline = { - fg = colors.fg0, - bg = colors.bg0, - bold = vim.g.gruvbox_bold, - underline = vim.g.gruvbox_underline, - }, - htmlBoldItalic = { fg = colors.fg0, bg = colors.bg0, bold = vim.g.gruvbox_bold, italic = vim.g.gruvbox_italic }, - htmlBoldUnderlineItalic = { - fg = colors.fg0, - bg = colors.bg0, - bold = vim.g.gruvbox_bold, - italic = vim.g.gruvbox_italic, - underline = vim.g.gruvbox_underline, - }, - htmlUnderline = { fg = colors.fg0, bg = colors.bg0, underline = vim.g.gruvbox_underline }, - htmlUnderlineItalic = { - fg = colors.fg0, - bg = colors.bg0, - italic = vim.g.gruvbox_italic, - underline = vim.g.gruvbox_underline, - }, - htmlItalic = { fg = colors.fg0, bg = colors.bg0, bold = vim.g.gruvbox_italic }, -} - -local langs = utils.merge({ - xml, - purescript, - coffeescript, - objc, - moonscript, - elixir, - markdown, - haskell, - html, -}) - -return langs diff --git a/lua/gruvbox/lightline.lua b/lua/gruvbox/lightline.lua index 3e3991ef..42b7c14e 100644 --- a/lua/gruvbox/lightline.lua +++ b/lua/gruvbox/lightline.lua @@ -1,5 +1,6 @@ -- lightline support -local theme = require("gruvbox.base") +local theme = require("gruvbox.groups").setup() + local bg0 = theme.GruvboxBg0.fg local bg1 = theme.GruvboxBg1.fg local bg2 = theme.GruvboxBg2.fg diff --git a/lua/gruvbox/colors.lua b/lua/gruvbox/palette.lua similarity index 100% rename from lua/gruvbox/colors.lua rename to lua/gruvbox/palette.lua diff --git a/lua/gruvbox/plugins.lua b/lua/gruvbox/plugins.lua deleted file mode 100644 index f48163c4..00000000 --- a/lua/gruvbox/plugins.lua +++ /dev/null @@ -1,274 +0,0 @@ --- 3rd party plugins highlights -local base = require("gruvbox.base") -local colors = require("gruvbox.colors") - -local plugins = { - -- netrw - netrwDir = base.GruvboxAqua, - netrwClassify = base.GruvboxAqua, - netrwLink = base.GruvboxGray, - netrwSymLink = base.GruvboxFg1, - netrwExe = base.GruvboxYellow, - netrwComment = base.GruvboxGray, - netrwList = base.GruvboxBlue, - netrwHelpCmd = base.GruvboxAqua, - netrwCmdSep = base.GruvboxFg3, - netrwVersion = base.GruvboxGreen, - -- nvim-treesitter - TSNone = {}, - TSError = {}, - TSTitle = base.Title, - TSLiteral = base.String, - TSURI = base.Underlined, - TSVariable = base.GruvboxFg1, - TSPunctDelimiter = base.Delimiter, - TSPunctBracket = base.Delimiter, - TSPunctSpecial = base.Delimiter, - TSConstant = base.Constant, - TSConstBuiltin = base.Special, - TSConstMacro = base.Define, - TSString = base.String, - TSStringRegex = base.String, - TSStringEscape = base.SpecialChar, - TSCharacter = base.Character, - TSNumber = base.Number, - TSBoolean = base.Boolean, - TSFloat = base.Float, - TSFunction = base.Function, - TSFuncBuiltin = base.Special, - TSFuncMacro = base.Macro, - TSParameter = base.Identifier, - TSParameterReference = { link = "TSParameter" }, - TSMethod = base.Function, - TSField = base.Identifier, - TSProperty = base.Identifier, - TSConstructor = base.Special, - TSAnnotation = base.PreProc, - TSAttribute = base.PreProc, - TSNamespace = base.Include, - TSConditional = base.Conditional, - TSRepeat = base.Repeat, - TSLabel = base.Label, - TSOperator = base.Operator, - TSKeyword = base.Keyword, - TSKeywordFunction = base.Keyword, - TSKeywordOperator = base.GruvboxRed, - TSException = base.Exception, - TSType = base.Type, - TSTypeBuiltin = base.Type, - TSInclude = base.Include, - TSVariableBuiltin = base.Special, - TSText = { link = "TSNone" }, - TSStrong = { bold = vim.g.gruvbox_bold }, - TSEmphasis = { italic = vim.g.gruvbox_italicize_strings }, - TSUnderline = { underline = vim.g.gruvbox_underline }, - TSComment = base.Comment, - TSStructure = base.GruvboxOrange, - TSTag = base.GruvboxOrange, - TSTagDelimiter = base.GruvboxGreen, - - -- telescope.nvim - TelescopeSelection = base.GruvboxOrangeBold, - TelescopeSlectionCaret = base.GruvboxRed, - TelescopeMultiSelection = base.GruvboxGray, - TelescopeNormal = base.GruvboxFg1, - TelescopeBorder = { link = "TelescopeNormal" }, - TelescopePromptBorder = { link = "TelescopeNormal" }, - TelescopeResultsBorder = { link = "TelescopeNormal" }, - TelescopePreviewBorder = { link = "TelescopeNormal" }, - TelescopeMatching = base.GruvboxBlue, - TelescopePromptPrefix = base.GruvboxRed, - TelescopePrompt = { link = "TelescopeNormal" }, - -- lspsaga.nvim - LspSagaDiagnosticBorder = base.NormalNC, - LspSagaDiagnosticHeader = base.GruvboxRed, - LspSagaDiagnosticTruncateLine = base.NormalNC, - LspFloatWinBorder = base.NormalNC, - LspSagaBorderTitle = base.Title, - TargetWord = base.Error, - ReferencesCount = base.Title, - ReferencesIcon = base.Special, - DefinitionCount = base.Title, - TargetFileName = base.Comment, - DefinitionIcon = base.Special, - ProviderTruncateLine = base.NormalNC, - SagaShadow = base.GruvboxBg0, - LspSagaFinderSelection = base.Search, - DiagnosticTruncateLine = base.NormalNC, - DiagnosticWarning = base.DiagnosticWarn, - DiagnosticInformation = base.DiagnosticInfo, - DefinitionPreviewTitle = base.Title, - LspSagaShTruncateLine = base.NormalNC, - LspSagaDocTruncateLine = base.NormalNC, - LineDiagTuncateLine = base.NormalNC, - LspSagaCodeActionTitle = base.Title, - LspSagaCodeActionTruncateLine = base.NormalNC, - LspSagaCodeActionContent = base.Normal, - LspSagaRenamePromptPrefix = base.GruvboxFg2, - LspSagaRenameBorder = { bold = vim.g.gruvbox_bold }, - LspSagaHoverBorder = { bold = vim.g.gruvbox_bold }, - LspSagaSignatureHelpBorder = { bold = vim.g.gruvbox_bold }, - LspSagaCodeActionBorder = { bold = vim.g.gruvbox_bold }, - LspSagaAutoPreview = {}, - LspSagaDefPreviewBorder = { bold = vim.g.gruvbox_bold }, - LspLinesDiagBorder = { bold = vim.g.gruvbox_bold }, - -- vim-startify - StartifyBracket = base.GruvboxFg3, - StartifyFile = base.GruvboxFg1, - StartifyNumber = base.GruvboxBlue, - StartifyPath = base.GruvboxGray, - StartifySlash = base.GruvboxGray, - StartifySection = base.GruvboxYellow, - StartifySpecial = base.GruvboxBg2, - StartifyHeader = base.GruvboxOrange, - StartifyFooter = base.GruvboxBg2, - StartifyVar = { link = "StartifyPath" }, - StartifySelect = base.Title, - -- vim-signify - SignifySignAdd = base.GruvboxGreenSign, - SignifySignChange = base.GruvboxAquaSign, - SignifySignDelete = base.GruvboxRedSign, - -- syntastic - SyntasticError = base.GruvboxRedUnderline, - SyntasticWarning = base.GruvboxYellowUnderline, - SyntasticErrorSign = base.GruvboxRedSign, - SyntasticWarningSign = base.GruvboxYellowSign, - -- termdebug - debugPC = { bg = colors.faded_blue }, - debugBreakpoint = base.GruvboxRedSign, - -- vim-dirvish - DirvishPathTail = base.GruvboxAqua, - DirvishArg = base.GruvboxYellow, - -- nerdtree - NERDTreeDir = base.GruvboxAqua, - NERDTreeDirSlash = base.GruvboxAqua, - NERDTreeOpenable = base.GruvboxOrange, - NERDTreeClosable = base.GruvboxOrange, - NERDTreeFile = base.GruvboxFg1, - NERDTreeExecFile = base.GruvboxYellow, - NERDTreeUp = base.GruvboxGray, - NERDTreeCWD = base.GruvboxGreen, - NERDTreeHelp = base.GruvboxFg1, - NERDTreeToggleOn = base.GruvboxGreen, - NERDTreeToggleOff = base.GruvboxRed, - -- coc.nvim - CocErrorSign = base.GruvboxRedSign, - CocWarningSign = base.GruvboxOrangeSign, - CocInfoSign = base.GruvboxBlueSign, - CocHintSign = base.GruvboxAquaSign, - CocErrorFloat = base.GruvboxRed, - CocWarningFloat = base.GruvboxOrange, - CocInfoFloat = base.GruvboxBlue, - CocHintFloat = base.GruvboxAqua, - CocDiagnosticsError = base.GruvboxRed, - CocDiagnosticsWarning = base.GruvboxOrange, - CocDiagnosticsInfo = base.GruvboxBlue, - CocDiagnosticsHint = base.GruvboxAqua, - CocSelectedText = base.GruvboxRed, - CocCodeLens = base.GruvboxGray, - CocErrorHighlight = base.GruvboxRedUnderline, - CocWarningHighlight = base.GruvboxOrangeUnderline, - CocInfoHighlight = base.GruvboxBlueUnderline, - CocHintHighlight = base.GruvboxAquaUnderline, - -- ale.vim - ALEError = base.GruvboxRedUnderline, - ALEWarning = base.GruvboxYellowUnderline, - ALEInfo = base.GruvboxBlueUnderline, - ALEErrorSign = base.GruvboxRedSign, - ALEWarningSign = base.GruvboxYellowSign, - ALEInfoSign = base.GruvboxBlueSign, - ALEVirtualTextError = base.GruvboxRed, - ALEVirtualTextWarning = base.GruvboxYellow, - ALEVirtualTextInfo = base.GruvboxBlue, - -- vim-buftabline - BufTabLineCurrent = base.TabLineSel, - BufTabLineActive = base.PmenuSel, - BufTabLineHidden = base.TabLine, - BufTabLineFill = base.TabLineFill, - BufTabLineModifiedCurrent = { link = "BufTabLineCurrent" }, - BufTabLineModifiedActive = { link = "BufTabLineActive" }, - BufTabLineModifiedHidden = { link = "BufTabLineHidden" }, - -- ctrlP - CtrlPMatch = base.Identifier, - CtrlPNoEntries = base.Error, - CtrlPPrtBase = base.Comment, - CtrlPPrtCursor = base.Constant, - CtrlPLinePre = { fg = base.GruvboxBg2.fg }, - CtrlPMode1 = base.Character, - CtrlPMode2 = base.LineNr, - CtrlPStats = base.Function, - -- fzf.vim - Fzf1 = { fg = base.GruvboxBlue.fg, bg = base.GruvboxBg1.fg }, - Fzf2 = { fg = base.GruvboxOrange.fg, bg = base.GruvboxBg1.fg }, - Fzf3 = { fg = base.GruvboxFg4.fg, bg = base.GruvboxBg1.fg }, - ShowMarksHLl = base.GruvboxBlueSign, - ShowMarksHLu = base.GruvboxBlueSign, - ShowMarksHLo = base.GruvboxBlueSign, - ShowMarksHLm = base.GruvboxBlueSign, - -- git-gutter - GitGutterAdd = base.GruvboxGreenSign, - GitGutterChange = base.GruvboxAquaSign, - GitGutterDelete = base.GruvboxRedSign, - GitGutterChangeDelete = base.GruvboxAquaSign, - -- gitsigns.nvim - GitSignsAdd = base.GruvboxGreenSign, - GitSignsChange = base.GruvboxOrangeSign, - GitSignsDelete = base.GruvboxRedSign, - GitSignsCurrentLineBlame = base.NonText, - -- nvim-cmp - CmpItemAbbr = base.GruvboxFg0, - CmpItemAbbrDeprecated = base.GruvboxFg0, - CmpItemAbbrMatch = base.GruvboxBlue, - CmpItemAbbrMatchFuzzy = { underline = vim.g.gruvbox_underline, fg = base.GruvboxAqua.fg }, - CmpItemKind = base.GruvboxOrange, - CmpItemKindClass = base.GruvboxGreen, - CmpItemKindConstructor = base.GruvboxGreen, - CmpItemKindField = base.GruvboxAqua, - CmpItemKindFile = base.GruvboxOrange, - CmpItemKindFolder = base.GruvboxOrange, - CmpItemKindFunction = base.GruvboxPurple, - CmpItemKindInterface = base.GruvboxGreen, - CmpItemKindKeyword = base.Keyword, - CmpItemKindMethod = base.GruvboxPurple, - CmpItemKindSnippet = base.GruvboxYellow, - CmpItemKindText = base.GruvboxFg0, - CmpItemKindValue = base.GruvboxOrange, - CmpItemKindVariable = base.GruvboxBlue, - CmpItemMenu = base.GruvboxGray, - -- LSP - LspCodeLens = base.GruvboxGray, - LspReferenceRead = { bg = base.GruvboxBg2.fg, underline = vim.g.gruvbox_underline }, - LspReferenceText = { bg = base.GruvboxBg2.fg, underline = vim.g.gruvbox_underline }, - LspReferenceWrite = { bg = base.GruvboxBg2.fg, underline = vim.g.gruvbox_underline }, - -- Diagnostic - DiagnosticError = base.GruvboxRed, - DiagnosticSignError = base.GruvboxRedSign, - DiagnosticUnderlineError = base.GruvboxRedUnderline, - DiagnosticWarn = base.GruvboxYellow, - DiagnosticSignWarn = base.GruvboxYellowSign, - DiagnosticUnderlineWarn = base.GruvboxYellowUnderline, - DiagnosticInfo = base.GruvboxBlue, - DiagnosticSignInfo = base.GruvboxBlueSign, - DiagnosticUnderlineInfo = base.GruvboxBlueUnderline, - DiagnosticHint = base.GruvboxAqua, - DiagnosticSignHint = base.GruvboxAquaSign, - DiagnosticUnderlineHint = base.GruvboxAquaUnderline, - DiagnosticFloatingError = base.GruvboxRed, - DiagnosticFloatingWarn = base.GruvboxOrange, - DiagnosticFloatingInfo = base.GruvboxBlue, - DiagnosticFloatingHint = base.GruvboxAqua, - DiagnosticVirtualTextError = base.GruvboxRed, - DiagnosticVirtualTextWarn = base.GruvboxYellow, - DiagnosticVirtualTextInfo = base.GruvboxBlue, - DiagnosticVirtualTextHint = base.GruvboxAqua, - -- mail.vim - mailQuoted1 = base.GruvboxAqua, - mailQuoted2 = base.GruvboxPurple, - mailQuoted3 = base.GruvboxYellow, - mailQuoted4 = base.GruvboxGreen, - mailQuoted5 = base.GruvboxRed, - mailQuoted6 = base.GruvboxOrange, - mailSignature = base.Comment, -} - -return plugins diff --git a/lua/gruvbox/utils.lua b/lua/gruvbox/utils.lua deleted file mode 100644 index 1c1a17b0..00000000 --- a/lua/gruvbox/utils.lua +++ /dev/null @@ -1,42 +0,0 @@ --- util functions -local M = {} -local hl = vim.api.nvim_set_hl - --- check if vim.g.gruvbox_* color exists in current palette, return default color --- otherwise -M.get_color_from_var = function(color, default, colors) - if color == nil then - return default - end - - local c = colors[color] - if c == nil then - print(string.format("%s color could not be found, using default", color)) - return default - end - return c -end - -M.merge = function(tbls) - local source = {} - for _, group in pairs(tbls) do - for groupName, opts in pairs(group) do - source[groupName] = opts - end - end - - return source -end - -M.add_highlights = function(hls) - for group, settings in pairs(hls) do - -- https://github.com/akinsho/bufferline.nvim/issues/386#issuecomment-1103849289 - if group == "Normal" then - vim.cmd(string.format("hi! Normal guifg=%s guibg=%s", settings.fg, settings.bg)) - else - hl(0, group, settings) - end - end -end - -return M diff --git a/tests/gruvbox/gruvbox_spec.lua b/tests/gruvbox/gruvbox_spec.lua new file mode 100644 index 00000000..9ab5cdc5 --- /dev/null +++ b/tests/gruvbox/gruvbox_spec.lua @@ -0,0 +1,113 @@ +require("plenary.reload").reload_module("gruvbox", true) +local gruvbox = require("gruvbox") + +describe("setup", function() + it("works with default values", function() + local expected = { + undercurl = true, + underline = true, + bold = true, + italic = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + contrast = "hard", + overrides = {}, + } + + gruvbox.setup() + assert.are.same(gruvbox.config, expected) + end) + + it("works with config overrides", function() + local expected = { + undercurl = false, + underline = false, + bold = true, + italic = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + contrast = "hard", + overrides = {}, + } + + gruvbox.setup({ undercurl = false, underline = false }) + assert.are.same(gruvbox.config, expected) + end) +end) + +describe("highlight overrides", function() + it("should override a hightlight color", function() + local config = { + overrides = { + Search = { fg = "#ff9900", bg = "#000000" }, + ColorColumn = { bg = "#ff9900" }, + }, + } + + gruvbox.setup(config) + gruvbox.load() + + local search_group_id = vim.api.nvim_get_hl_id_by_name("Search") + local search_values = { + background = vim.fn.synIDattr(search_group_id, "bg", "gui"), + foreground = vim.fn.synIDattr(search_group_id, "fg", "gui"), + } + + assert.are.same(search_values, { background = "#000000", foreground = "#ff9900" }) + + local color_column_group_id = vim.api.nvim_get_hl_id_by_name("ColorColumn") + local color_column_values = { + background = vim.fn.synIDattr(color_column_group_id, "bg", "gui"), + } + + assert.are.same(color_column_values, { background = "#ff9900" }) + end) + + it("should create new hightlights colors if they dont exist", function() + local config = { + overrides = { + Search = { fg = "#ff9900", bg = "#000000" }, + New = { bg = "#ff9900" }, + }, + } + + gruvbox.setup(config) + gruvbox.load() + + local search_group_id = vim.api.nvim_get_hl_id_by_name("Search") + local search_values = { + background = vim.fn.synIDattr(search_group_id, "bg", "gui"), + foreground = vim.fn.synIDattr(search_group_id, "fg", "gui"), + } + + assert.are.same(search_values, { background = "#000000", foreground = "#ff9900" }) + + local new_group_id = vim.api.nvim_get_hl_id_by_name("New") + local new_group_values = { + background = vim.fn.synIDattr(new_group_id, "bg", "gui"), + } + + assert.are.same(new_group_values, { background = "#ff9900" }) + end) + + it("should override links", function() + local config = { + overrides = { + Function = { bg = "#990000" }, + }, + } + + gruvbox.setup(config) + gruvbox.load() + + local group_id = vim.api.nvim_get_hl_id_by_name("Function") + local values = { + background = vim.fn.synIDattr(group_id, "bg", "gui"), + } + assert.are.same(values, { background = "#990000" }) + end) +end) diff --git a/tests/minimal_init.lua b/tests/minimal_init.lua new file mode 100644 index 00000000..b4c8c23d --- /dev/null +++ b/tests/minimal_init.lua @@ -0,0 +1,11 @@ +local plenary_dir = os.getenv("PLENARY_DIR") or "/tmp/plenary.nvim" +local is_not_a_directory = vim.fn.isdirectory(plenary_dir) == 0 +if is_not_a_directory then + vim.fn.system({ "git", "clone", "https://github.com/nvim-lua/plenary.nvim", plenary_dir }) +end + +vim.opt.rtp:append(".") +vim.opt.rtp:append(plenary_dir) + +vim.cmd("runtime plugin/plenary.vim") +require("plenary.busted")