aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorEllison <ellisonleao@gmail.com>2022-04-17 19:25:20 -0300
committerGitHub <noreply@github.com>2022-04-17 19:25:20 -0300
commit2103170eb9edb0aa90ee2a34f9fea16cc5690cd5 (patch)
treec1dd1435af469ad65f42d7748c6863006be63af2 /lua
parentdc6bae93ded04ac542d429ff5cc87189dde44294 (diff)
downloadgruvbox-2103170eb9edb0aa90ee2a34f9fea16cc5690cd5.tar.gz
gruvbox-2103170eb9edb0aa90ee2a34f9fea16cc5690cd5.tar.xz
Resolve #99 (#103)
* initial work on #99 * remove comments * goodbye neovim 0.6. Using new hl system, now working
Diffstat (limited to 'lua')
-rw-r--r--lua/gruvbox/base.lua115
-rw-r--r--lua/gruvbox/init.lua10
-rw-r--r--lua/gruvbox/languages.lua30
-rw-r--r--lua/gruvbox/lightline.lua (renamed from lua/gruvbox/plugins/lightline.lua)0
-rw-r--r--lua/gruvbox/plugins.lua (renamed from lua/gruvbox/plugins/highlights.lua)27
-rw-r--r--lua/gruvbox/settings.lua58
-rw-r--r--lua/gruvbox/utils.lua34
7 files changed, 102 insertions, 172 deletions
diff --git a/lua/gruvbox/base.lua b/lua/gruvbox/base.lua
index 7092fb1..8016a7b 100644
--- a/lua/gruvbox/base.lua
+++ b/lua/gruvbox/base.lua
@@ -1,7 +1,12 @@
local colors = require("gruvbox.colors")
-local styles = require("gruvbox.settings").styles
local utils = require("gruvbox.utils")
+-- reset colors
+vim.cmd("hi clear")
+if vim.fn.exists("syntax_on") then
+ vim.cmd("syntax reset")
+end
+
-- options (dark mode by default)
local bg0 = colors.dark0
local bg1 = colors.dark1
@@ -24,7 +29,7 @@ local aqua = colors.bright_aqua
local orange = colors.bright_orange
local gray = colors.gray
-local bg = vim.o.background
+local bg = vim.opt.background:get()
if bg == nil then
bg = "dark"
vim.o.background = bg
@@ -89,17 +94,14 @@ local cursor_line = utils.get_color_from_var(vim.g.gruvbox_cursor_line, bg1, col
local improved_strings_fg = fg1
local improved_strings_bg = bg1
-local improved_strings_gui = styles.italic_strings
local special_string_fg = orange
local special_string_bg = bg1
-local special_string_gui = styles.italic_strings
-if not utils.tobool(vim.g.gruvbox_improved_strings) then
+if not vim.g.gruvbox_improved_strings then
improved_strings_fg = green
improved_strings_bg = nil
special_string_bg = nil
- special_string_gui = nil
end
-- neovim terminal mode colors
@@ -122,8 +124,6 @@ vim.g.terminal_color_15 = fg1
vim.g.colors_name = "gruvbox"
-local table_concat = table.concat
-
local base_group = {
-- Base groups
GruvboxFg0 = { fg = fg0 },
@@ -139,39 +139,39 @@ local base_group = {
GruvboxBg4 = { fg = bg4 },
GruvboxRed = { fg = red },
- GruvboxRedBold = { fg = red, gui = styles.bold },
+ GruvboxRedBold = { fg = red, bold = vim.g.gruvbox_bold },
GruvboxGreen = { fg = green },
- GruvboxGreenBold = { fg = green, gui = styles.bold },
+ GruvboxGreenBold = { fg = green, bold = vim.g.gruvbox_bold },
GruvboxYellow = { fg = yellow },
- GruvboxYellowBold = { fg = yellow, gui = styles.bold },
+ GruvboxYellowBold = { fg = yellow, bold = vim.g.gruvbox_bold },
GruvboxBlue = { fg = blue },
- GruvboxBlueBold = { fg = blue, gui = styles.bold },
+ GruvboxBlueBold = { fg = blue, bold = vim.g.gruvbox_bold },
GruvboxPurple = { fg = purple },
- GruvboxPurpleBold = { fg = purple, gui = styles.bold },
+ GruvboxPurpleBold = { fg = purple, bold = vim.g.gruvbox_bold },
GruvboxAqua = { fg = aqua },
- GruvboxAquaBold = { fg = aqua, gui = styles.bold },
+ GruvboxAquaBold = { fg = aqua, bold = vim.g.gruvbox_bold },
GruvboxOrange = { fg = orange },
- GruvboxOrangeBold = { fg = orange, gui = styles.bold },
+ GruvboxOrangeBold = { fg = orange, bold = vim.g.gruvbox_bold },
- GruvboxRedSign = { fg = red, bg = sign_column, gui = styles.invert_signs },
- GruvboxGreenSign = { fg = green, bg = sign_column, gui = styles.invert_signs },
- GruvboxYellowSign = { fg = yellow, bg = sign_column, gui = styles.invert_signs },
- GruvboxBlueSign = { fg = blue, bg = sign_column, gui = styles.invert_signs },
- GruvboxPurpleSign = { fg = purple, bg = sign_column, gui = styles.invert_signs },
- GruvboxAquaSign = { fg = aqua, bg = sign_column, gui = styles.invert_signs },
- GruvboxOrangeSign = { fg = orange, bg = sign_column, gui = styles.invert_signs },
+ GruvboxRedSign = { fg = red, bg = sign_column, inverse = vim.g.gruvbox_invert_signs },
+ GruvboxGreenSign = { fg = green, bg = sign_column, inverse = vim.g.gruvbox_invert_signs },
+ GruvboxYellowSign = { fg = yellow, bg = sign_column, inverse = vim.g.gruvbox_invert_signs },
+ GruvboxBlueSign = { fg = blue, bg = sign_column, inverse = vim.g.gruvbox_invert_signs },
+ GruvboxPurpleSign = { fg = purple, bg = sign_column, inverse = vim.g.gruvbox_invert_signs },
+ GruvboxAquaSign = { fg = aqua, bg = sign_column, inverse = vim.g.gruvbox_invert_signs },
+ GruvboxOrangeSign = { fg = orange, bg = sign_column, inverse = vim.g.gruvbox_invert_signs },
- GruvboxRedUnderline = { gui = styles.undercurl, sp = red },
- GruvboxGreenUnderline = { gui = styles.undercurl, sp = green },
- GruvboxYellowUnderline = { gui = styles.undercurl, sp = yellow },
- GruvboxBlueUnderline = { gui = styles.undercurl, sp = blue },
- GruvboxPurpleUnderline = { gui = styles.undercurl, sp = purple },
- GruvboxAquaUnderline = { gui = styles.undercurl, sp = aqua },
- GruvboxOrangeUnderline = { gui = styles.undercurl, sp = orange },
+ 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 = { gui = styles.inverse },
+ Cursor = { inverse = vim.g.gruvbox_inverse },
lCursor = "Cursor",
iCursor = "Cursor",
vCursor = "Cursor",
@@ -179,54 +179,55 @@ local base_group = {
CursorLine = { bg = cursor_line },
CursorColumn = "CursorLine",
Directory = "GruvboxGreenBold",
- DiffAdd = { fg = green, bg = bg0, gui = styles.inverse },
- DiffChange = { fg = aqua, bg = bg0, gui = styles.inverse },
- DiffDelete = { fg = red, bg = bg0, gui = styles.inverse },
- DiffText = { fg = yellow, bg = bg0, gui = styles.inverse },
- ErrorMsg = { fg = bg0, bg = red, gui = styles.bold },
+ DiffAdd = { fg = green, bg = bg0, inverse = vim.g.gruvbox_inverse },
+ DiffChange = { fg = aqua, bg = bg0, inverse = vim.g.gruvbox_inverse },
+ DiffDelete = { fg = red, bg = bg0, inverse = vim.g.gruvbox_inverse },
+ DiffText = { fg = yellow, bg = bg0, inverse = 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, gui = styles.italic },
+ 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, gui = styles.inverse },
+ IncSearch = { fg = hls_cursor, bg = bg0, inverse = vim.g.gruvbox_inverse },
LineNr = { fg = bg4, bg = number_column },
CursorLineNr = { fg = yellow, bg = bg1 },
- MatchParen = { bg = bg3, gui = styles.bold },
+ MatchParen = { bg = bg3, bold = vim.g.gruvbox_bold },
ModeMsg = "GruvboxYellowBold",
MoreMsg = "GruvboxYellowBold",
NonText = "GruvboxBg2",
Normal = { fg = fg1, bg = bg0 },
Pmenu = { fg = fg1, bg = bg2 },
- PmenuSel = { fg = bg2, bg = blue, gui = styles.bold },
+ PmenuSel = { fg = bg2, bg = blue, bold = vim.g.gruvbox_bold },
PmenuSbar = { bg = bg2 },
PmenuThumb = { bg = bg4 },
Question = "GruvboxOrangeBold",
- QuickFixLine = { bg = bg0, gui = styles.bold },
- Search = { fg = hls_highlight, bg = bg0, gui = styles.inverse },
+ QuickFixLine = { bg = bg0, bold = vim.g.gruvbox_bold },
+ Search = { fg = hls_highlight, bg = bg0, inverse = vim.g.gruvbox_inverse },
SpecialKey = "GruvboxFg4",
SpellRare = "GruvboxPurpleUnderline",
SpellBad = "GruvboxRedUnderline",
SpellLocal = "GruvboxAquaUnderline",
- SpellCap = utils.tobool(vim.g.gruvbox_improved_warnings) and {
+ SpellCap = vim.g.gruvbox_improved_warnings and {
fg = green,
- gui = table_concat({ styles.bold, styles.italic }, ","),
+ bold = vim.g.gruvbox_bold,
+ italic = vim.g.gruvbox_italic,
} or "GruvboxBlueUnderline",
- StatusLine = { fg = bg2, bg = fg1, gui = styles.inverse },
- StatusLineNC = { fg = bg1, bg = fg4, gui = styles.inverse },
- TabLineFill = { fg = bg4, bg = bg1, gui = styles.invert_tabline },
+ StatusLine = { fg = bg2, bg = fg1, inverse = vim.g.gruvbox_inverse },
+ StatusLineNC = { fg = bg1, bg = fg4, inverse = vim.g.gruvbox_inverse },
+ TabLineFill = { fg = bg4, bg = bg1, inverse = vim.g.gruvbox_invert_tabline },
TabLine = "TabLineFill",
- TabLineSel = { fg = tabline_sel, bg = bg1, gui = styles.invert_tabline },
+ TabLineSel = { fg = tabline_sel, bg = bg1, inverse = vim.g.gruvbox_invert_tabline },
Title = "GruvboxGreenBold",
- Visual = { bg = bg3, gui = styles.invert_selection },
+ Visual = { bg = bg3, inverse = vim.g.gruvbox_invert_selection },
VisualNOS = "Visual",
WarningMsg = "GruvboxRedBold",
- WildMenu = { fg = blue, bg = bg2, gui = styles.bold },
+ WildMenu = { fg = blue, bg = bg2, bold = vim.g.gruvbox_bold },
Constant = "GruvboxPurple",
- Special = { fg = special_string_fg, bg = special_string_bg, gui = special_string_gui },
+ Special = { fg = special_string_fg, bg = special_string_bg, italic = vim.g.gruvbox_improved_strings },
String = {
fg = improved_strings_fg,
bg = improved_strings_bg,
- gui = improved_strings_gui,
+ italic = vim.g.gruvbox_italicize_strings,
},
Character = "GruvboxPurple",
Number = "GruvboxPurple",
@@ -253,14 +254,14 @@ local base_group = {
SpecialChar = "GruvboxRed",
Tag = "GruvboxAquaBold",
Delimiter = "GruvboxFg3",
- Comment = { fg = gray, gui = styles.italic_comments },
+ Comment = { fg = gray, italic = vim.g.gruvbox_italic_comments },
Debug = "GruvboxRed",
- Underlined = { fg = blue, gui = styles.underline },
- Bold = { gui = styles.bold },
- Italic = { gui = styles.italic },
+ Underlined = { fg = blue, underline = vim.g.gruvbox_underline },
+ Bold = { bold = vim.g.gruvbox_bold },
+ Italic = { italic = vim.g.gruvbox_italic },
Ignore = {},
- Error = { fg = red, gui = table_concat({ styles.bold, styles.inverse }, ",") },
- Todo = { fg = fg0, gui = table_concat({ styles.bold, styles.italic }, ",") },
+ Error = { fg = red, bold = vim.g.gruvbox_bold, inverse = vim.g.gruvbox_inverse },
+ Todo = { fg = fg0, bold = vim.g.gruvbox_bold, italic = vim.g.gruvbox_italic },
diffAdded = "GruvboxGreen",
diffRemoved = "GruvboxRed",
diffChanged = "GruvboxAqua",
diff --git a/lua/gruvbox/init.lua b/lua/gruvbox/init.lua
index eb9ff71..cb55b9c 100644
--- a/lua/gruvbox/init.lua
+++ b/lua/gruvbox/init.lua
@@ -1,5 +1,5 @@
local base = require("gruvbox.base")
-local plugins = require("gruvbox.plugins.highlights")
+local plugins = require("gruvbox.plugins")
local languages = require("gruvbox.languages")
local utils = require("gruvbox.utils")
@@ -8,7 +8,13 @@ local spec = utils.merge(specs)
local M = {}
M.load = function()
- utils.highlights(spec)
+ if vim.version().minor < 7 then
+ vim.api.nvim_err_writeln("gruvbox.nvim: you must use neovim 0.7 or higher")
+ return
+ end
+
+ vim.opt.termguicolors = true
+ utils.add_highlights(spec)
end
return M
diff --git a/lua/gruvbox/languages.lua b/lua/gruvbox/languages.lua
index 394f52d..97cad80 100644
--- a/lua/gruvbox/languages.lua
+++ b/lua/gruvbox/languages.lua
@@ -1,6 +1,5 @@
-- language specific higlights
local base = require("gruvbox.base")
-local styles = require("gruvbox.settings").styles
local utils = require("gruvbox.utils")
local colors = require("gruvbox.colors")
@@ -69,11 +68,12 @@ local elixir = {
}
local markdown = {
- markdownItalic = { fg = base.GruvboxFg3.fg, gui = styles.italic },
- markdownBold = { fg = base.GruvboxFg3.fg, gui = styles.bold },
+ 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,
- gui = table.concat({ styles.bold, styles.italic }, ","),
+ bold = vim.g.gruvbox_bold,
+ italic = vim.g.gruvbox_italic,
},
markdownH1 = base.GruvboxGreenBold,
markdownH2 = "markdownH1",
@@ -95,7 +95,7 @@ local markdown = {
markdownHeadingDelimiter = base.GruvboxOrange,
markdownUrl = base.GruvboxPurple,
markdownUrlTitleDelimiter = base.GruvboxGreen,
- markdownLinkText = { fg = base.GruvboxGray.fg, gui = styles.underline },
+ markdownLinkText = { fg = base.GruvboxGray.fg, underline = vim.g.gruvbox_underline },
markdownIdDeclaration = "markdownLinkText",
}
@@ -143,27 +143,31 @@ local html = {
htmlArg = base.GruvboxOrange,
htmlTagN = base.GruvboxFg1,
htmlSpecialTagName = base.GruvboxBlue,
- htmlLink = { fg = colors.fg4, gui = styles.underline },
+ htmlLink = { fg = colors.fg4, underline = vim.g.gruvbox_underline },
htmlSpecialChar = "GruvboxRed",
- htmlBold = { fg = colors.fg0, bg = colors.bg0, gui = styles.bold },
+ htmlBold = { fg = colors.fg0, bg = colors.bg0, bold = vim.g.gruvbox_bold },
htmlBoldUnderline = {
fg = colors.fg0,
bg = colors.bg0,
- gui = table.concat({ styles.bold, styles.underline }, ","),
+ bold = vim.g.gruvbox_bold,
+ underline = vim.g.gruvbox_underline,
},
- htmlBoldItalic = { fg = colors.fg0, bg = colors.bg0, gui = table.concat({ styles.bold, styles.italic }, ",") },
+ htmlBoldItalic = { fg = colors.fg0, bg = colors.bg0, bold = vim.g.gruvbox_bold, italic = vim.g.gruvbox_italic },
htmlBoldUnderlineItalic = {
fg = colors.fg0,
bg = colors.bg0,
- gui = table.concat({ styles.bold, styles.underline, styles.italic }, ","),
+ bold = vim.g.gruvbox_bold,
+ italic = vim.g.gruvbox_italic,
+ underline = vim.g.gruvbox_underline,
},
- htmlUnderline = { fg = colors.fg0, bg = colors.bg0, gui = styles.underline },
+ htmlUnderline = { fg = colors.fg0, bg = colors.bg0, underline = vim.g.gruvbox_underline },
htmlUnderlineItalic = {
fg = colors.fg0,
bg = colors.bg0,
- gui = table.concat({ styles.underline, styles.italic }, ","),
+ italic = vim.g.gruvbox_italic,
+ underline = vim.g.gruvbox_underline,
},
- htmlItalic = { fg = colors.fg0, bg = colors.bg0, gui = styles.italic },
+ htmlItalic = { fg = colors.fg0, bg = colors.bg0, bold = vim.g.gruvbox_italic },
}
local langs = utils.merge({
diff --git a/lua/gruvbox/plugins/lightline.lua b/lua/gruvbox/lightline.lua
index 3e3991e..3e3991e 100644
--- a/lua/gruvbox/plugins/lightline.lua
+++ b/lua/gruvbox/lightline.lua
diff --git a/lua/gruvbox/plugins/highlights.lua b/lua/gruvbox/plugins.lua
index f90c1be..cd95cb8 100644
--- a/lua/gruvbox/plugins/highlights.lua
+++ b/lua/gruvbox/plugins.lua
@@ -1,6 +1,5 @@
-- 3rd party plugins highlights
local base = require("gruvbox.base")
-local styles = require("gruvbox.settings").styles
local colors = require("gruvbox.colors")
local plugins = {
@@ -60,9 +59,9 @@ local plugins = {
TSInclude = base.Include,
TSVariableBuiltin = base.Special,
TSText = "TSNone",
- TSStrong = { gui = styles.bold },
- TSEmphasis = { gui = styles.italic_strings },
- TSUnderline = { gui = styles.underline },
+ 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,
@@ -106,13 +105,13 @@ local plugins = {
LspSagaCodeActionTruncateLine = base.NormalNC,
LspSagaCodeActionContent = base.Normal,
LspSagaRenamePromptPrefix = base.GruvboxFg2,
- LspSagaRenameBorder = { gui = styles.bold },
- LspSagaHoverBorder = { gui = styles.bold },
- LspSagaSignatureHelpBorder = { gui = styles.bold },
- LspSagaCodeActionBorder = { gui = styles.bold },
+ 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 = { gui = styles.bold },
- LspLinesDiagBorder = { gui = styles.bold },
+ LspSagaDefPreviewBorder = { bold = vim.g.gruvbox_bold },
+ LspLinesDiagBorder = { bold = vim.g.gruvbox_bold },
-- vim-startify
StartifyBracket = base.GruvboxFg3,
StartifyFile = base.GruvboxFg1,
@@ -220,7 +219,7 @@ local plugins = {
CmpItemAbbr = base.GruvboxFg0,
CmpItemAbbrDeprecated = base.GruvboxFg0,
CmpItemAbbrMatch = base.GruvboxBlue,
- CmpItemAbbrMatchFuzzy = { gui = styles.underline, fg = base.GruvboxAqua.fg },
+ CmpItemAbbrMatchFuzzy = { underline = vim.g.gruvbox_underline, fg = base.GruvboxAqua.fg },
CmpItemKind = base.GruvboxOrange,
CmpItemKindClass = base.GruvboxGreen,
CmpItemKindConstructor = base.GruvboxGreen,
@@ -238,9 +237,9 @@ local plugins = {
CmpItemMenu = base.GruvboxGray,
-- LSP
LspCodeLens = base.GruvboxGray,
- LspReferenceRead = { bg = base.GruvboxBg2.fg, gui = styles.underline },
- LspReferenceText = { bg = base.GruvboxBg2.fg, gui = styles.underline },
- LspReferenceWrite = { bg = base.GruvboxBg2.fg, gui = styles.underline },
+ 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,
diff --git a/lua/gruvbox/settings.lua b/lua/gruvbox/settings.lua
index 3cd1078..c72b8c6 100644
--- a/lua/gruvbox/settings.lua
+++ b/lua/gruvbox/settings.lua
@@ -1,6 +1,4 @@
-- gruvbox settings handler
-local utils = require("gruvbox.utils")
-
local settings = {
contrast_dark = "medium",
contrast_light = "medium",
@@ -19,19 +17,6 @@ local settings = {
invert_intend_guides = false,
}
-local styles = {
- italic = "italic",
- bold = "bold",
- underline = "underline",
- inverse = "inverse",
- undercurl = "undercurl",
- invert_signs = "",
- invert_selection = "inverse",
- invert_tabline = "",
- italic_comments = "italic",
- italic_strings = "NONE",
-}
-
-- setting default values
for k, val in pairs(settings) do
local key = "gruvbox_" .. k
@@ -40,45 +25,4 @@ for k, val in pairs(settings) do
end
end
--- styles check
-if not utils.tobool(vim.g.gruvbox_bold) then
- styles.bold = "NONE"
-end
-
-if not utils.tobool(vim.g.gruvbox_underline) then
- styles.underline = "NONE"
-end
-
-if not utils.tobool(vim.g.gruvbox_italic) then
- styles.italic = "NONE"
-end
-
-if not utils.tobool(vim.g.gruvbox_inverse) then
- styles.inverse = "NONE"
-end
-
-if not utils.tobool(vim.g.gruvbox_undercurl) then
- styles.undercurl = "NONE"
-end
-
-if utils.tobool(vim.g.gruvbox_invert_signs) then
- styles.invert_signs = "inverse"
-end
-
-if not utils.tobool(vim.g.gruvbox_invert_selection) then
- styles.invert_selection = "NONE"
-end
-
-if utils.tobool(vim.g.gruvbox_invert_tabline) then
- styles.invert_tabline = "inverse"
-end
-
-if not utils.tobool(vim.g.gruvbox_italicize_comments) then
- styles.italic_comments = "NONE"
-end
-
-if utils.tobool(vim.g.gruvbox_italicize_strings) then
- styles.italic_strings = "italic"
-end
-
-return { settings = settings, styles = styles }
+return settings
diff --git a/lua/gruvbox/utils.lua b/lua/gruvbox/utils.lua
index f9b5ccf..8138899 100644
--- a/lua/gruvbox/utils.lua
+++ b/lua/gruvbox/utils.lua
@@ -1,12 +1,7 @@
-- util functions
local M = {}
-
-M.tobool = function(val)
- if val == 0 or not val then
- return false
- end
- return true
-end
+local hl = vim.api.nvim_set_hl
+local link = vim.highlight.link
-- check if vim.g.gruvbox_* color exists in current palette, return default color
-- otherwise
@@ -34,31 +29,12 @@ M.merge = function(tbls)
return source
end
-M.highlights = function(hls)
+M.add_highlights = function(hls)
for k, v in pairs(hls) do
if type(v) == "table" then
- -- no blank strings allowed for guifg, guibg, guisp and gui
- local opt = {}
- for kk, vv in pairs(v) do
- if vv == "" then
- vv = nil
- end
-
- opt[kk] = vv
- end
-
- vim.cmd(
- string.format(
- "hi %s guifg=%s guibg=%s guisp=%s gui=%s",
- k,
- opt.fg or "NONE",
- opt.bg or "NONE",
- opt.sp or "NONE",
- opt.gui or "NONE"
- )
- )
+ hl(0, k, v)
else
- vim.cmd(string.format("hi! link %s %s", k, v))
+ link(k, v, true)
end
end
end