aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEllison <ellisonleao@gmail.com>2023-03-19 16:46:57 -0300
committerGitHub <noreply@github.com>2023-03-19 16:46:57 -0300
commit035f8a35d7e08833e75720feeff11f3461c80903 (patch)
tree901855cd958436592e8f41fc8ae2f005930096b5
parentc6ef9c5a3a2ece0f8635460291eb4a4c06ed3dcc (diff)
downloadgruvbox-035f8a35d7e08833e75720feeff11f3461c80903.tar.gz
gruvbox-035f8a35d7e08833e75720feeff11f3461c80903.tar.xz
New Italic configs (#222)
* feat(config): adding new italic config * using direct highlight call in vim.cmd * adding changelog releaser
-rw-r--r--.github/release.yml8
-rw-r--r--README.md7
-rw-r--r--lua/gruvbox/groups.lua28
-rw-r--r--lua/gruvbox/init.lua18
-rw-r--r--tests/gruvbox/gruvbox_spec.lua22
5 files changed, 62 insertions, 21 deletions
diff --git a/.github/release.yml b/.github/release.yml
new file mode 100644
index 0000000..43b4c10
--- /dev/null
+++ b/.github/release.yml
@@ -0,0 +1,8 @@
+changelog:
+ categories:
+ - title: Breaking Changes 🛠
+ labels:
+ - breaking-change
+ - title: Other Fixes and Improvements
+ labels:
+ - "*"
diff --git a/README.md b/README.md
index 58c207d..88bbdcc 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,12 @@ require("gruvbox").setup({
undercurl = true,
underline = true,
bold = true,
- italic = true,
+ italic = {
+ strings = true,
+ comments = true,
+ operators = false,
+ folds = true,
+ },
strikethrough = true,
invert_selection = false,
invert_signs = false,
diff --git a/lua/gruvbox/groups.lua b/lua/gruvbox/groups.lua
index a65cc25..6fd3b6e 100644
--- a/lua/gruvbox/groups.lua
+++ b/lua/gruvbox/groups.lua
@@ -109,23 +109,23 @@ M.setup = function()
WarningMsg = { link = "GruvboxRedBold" },
LineNr = { fg = colors.bg4 },
SignColumn = config.transparent_mode and { bg = nil } or { bg = colors.bg1 },
- Folded = { fg = colors.gray, bg = colors.bg1, italic = config.italic },
+ Folded = { fg = colors.gray, bg = colors.bg1, italic = config.italic.folds },
FoldColumn = config.transparent_mode and { fg = colors.gray, bg = nil } or { fg = colors.gray, bg = colors.bg1 },
Cursor = { reverse = config.inverse },
vCursor = { link = "Cursor" },
iCursor = { link = "Cursor" },
lCursor = { link = "Cursor" },
Special = { link = "GruvboxOrange" },
- Comment = { fg = colors.gray, italic = config.italic },
- Todo = { fg = colors.fg0, bold = config.bold, italic = config.italic },
- Done = { fg = colors.orange, bold = config.bold, italic = config.italic },
+ Comment = { fg = colors.gray, italic = config.italic.comments },
+ Todo = { fg = colors.fg0, bold = config.bold, italic = config.italic.comments },
+ Done = { fg = colors.orange, bold = config.bold, italic = config.italic.comments },
Error = { fg = colors.red, bold = config.bold, reverse = config.inverse },
Statement = { link = "GruvboxRed" },
Conditional = { link = "GruvboxRed" },
Repeat = { link = "GruvboxRed" },
Label = { link = "GruvboxRed" },
Exception = { link = "GruvboxRed" },
- Operator = { fg = colors.orange },
+ Operator = { fg = colors.orange, italic = config.italic.operators },
Keyword = { link = "GruvboxRed" },
Identifier = { link = "GruvboxBlue" },
Function = { link = "GruvboxGreenBold" },
@@ -136,7 +136,7 @@ M.setup = function()
PreCondit = { link = "GruvboxAqua" },
Constant = { link = "GruvboxPurple" },
Character = { link = "GruvboxPurple" },
- String = { fg = colors.green, italic = config.italic },
+ String = { fg = colors.green, italic = config.italic.strings },
Boolean = { link = "GruvboxPurple" },
Number = { link = "GruvboxPurple" },
Float = { link = "GruvboxPurple" },
@@ -257,7 +257,7 @@ M.setup = function()
-- nvim-treesitter (0.8 overrides)
["@text.strong"] = { bold = config.bold },
["@text.strike"] = { strikethrough = config.strikethrough },
- ["@text.emphasis"] = { italic = config.italic },
+ ["@text.emphasis"] = { italic = config.italic.strings },
["@text.underline"] = { underline = config.underline },
["@keyword.operator"] = { link = "GruvboxRed" },
-- gitcommit
@@ -427,22 +427,22 @@ M.setup = function()
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 },
+ htmlBoldItalic = { fg = colors.fg0, bg = colors.bg0, bold = config.bold, italic = true },
htmlBoldUnderlineItalic = {
fg = colors.fg0,
bg = colors.bg0,
bold = config.bold,
- italic = config.italic,
+ italic = true,
underline = config.underline,
},
htmlUnderline = { fg = colors.fg0, bg = colors.bg0, underline = config.underline },
htmlUnderlineItalic = {
fg = colors.fg0,
bg = colors.bg0,
- italic = config.italic,
+ italic = true,
underline = config.underline,
},
- htmlItalic = { fg = colors.fg0, bg = colors.bg0, bold = config.italic },
+ htmlItalic = { fg = colors.fg0, bg = colors.bg0, italic = true },
-- xml
xmlTag = { link = "GruvboxAquaBold" },
xmlEndTag = { link = "GruvboxAquaBold" },
@@ -640,9 +640,9 @@ M.setup = function()
scalaInstanceDeclaration = { link = "GruvboxFg1" },
scalaInterpolation = { link = "GruvboxAqua" },
-- markdown
- markdownItalic = { fg = colors.fg3, italic = config.italic },
+ markdownItalic = { fg = colors.fg3, italic = true },
markdownBold = { fg = colors.fg3, bold = config.bold },
- markdownBoldItalic = { fg = colors.fg3, bold = config.bold, italic = config.italic },
+ markdownBoldItalic = { fg = colors.fg3, bold = config.bold, italic = true },
markdownH1 = { link = "GruvboxGreenBold" },
markdownH2 = { link = "GruvboxGreenBold" },
markdownH3 = { link = "GruvboxYellowBold" },
@@ -759,7 +759,7 @@ M.setup = function()
DashboardShortCut = { link = "GruvboxOrange" },
DashboardHeader = { link = "GruvboxAqua" },
DashboardCenter = { link = "GruvboxYellow" },
- DashboardFooter = { fg = colors.purple, italic = config.italic },
+ DashboardFooter = { fg = colors.purple, italic = true },
-- mason
MasonHighlight = { link = "GruvboxAqua" },
MasonHighlightBlock = { fg = colors.bg0, bg = colors.blue },
diff --git a/lua/gruvbox/init.lua b/lua/gruvbox/init.lua
index 07de0ab..d287209 100644
--- a/lua/gruvbox/init.lua
+++ b/lua/gruvbox/init.lua
@@ -5,7 +5,12 @@ M.config = {
undercurl = true,
underline = true,
bold = true,
- italic = true,
+ italic = {
+ strings = true,
+ comments = true,
+ operators = false,
+ folds = true,
+ },
strikethrough = true,
invert_selection = false,
invert_signs = false,
@@ -20,7 +25,14 @@ M.config = {
}
function M.setup(config)
- M.config = vim.tbl_extend("force", M.config, config or {})
+ if config ~= nil and type(config.italic) == "boolean" then
+ vim.notify(
+ "[gruvbox] italic config has change. please check https://github.com/ellisonleao/gruvbox.nvim/issues/220",
+ vim.log.levels.WARN
+ )
+ config.italic = M.config.italic
+ end
+ M.config = vim.tbl_deep_extend("force", M.config, config or {})
end
M.load = function()
@@ -31,7 +43,7 @@ M.load = function()
-- reset colors
if vim.g.colors_name then
- vim.cmd("hi clear")
+ vim.cmd.hi("clear")
end
vim.g.colors_name = "gruvbox"
diff --git a/tests/gruvbox/gruvbox_spec.lua b/tests/gruvbox/gruvbox_spec.lua
index ed96742..7ed3cd5 100644
--- a/tests/gruvbox/gruvbox_spec.lua
+++ b/tests/gruvbox/gruvbox_spec.lua
@@ -1,14 +1,25 @@
require("plenary.reload").reload_module("gruvbox", true)
local gruvbox = require("gruvbox")
+local default = gruvbox.config
describe("setup", function()
it("works with default values", function()
+ gruvbox.setup()
+ assert.are.same(gruvbox.config, default)
+ end)
+
+ it("works with old italic values", function()
local expected = {
undercurl = true,
underline = true,
bold = true,
strikethrough = true,
- italic = true,
+ italic = {
+ strings = true,
+ comments = true,
+ operators = false,
+ folds = true,
+ },
inverse = true,
invert_selection = false,
invert_signs = false,
@@ -21,7 +32,7 @@ describe("setup", function()
transparent_mode = false,
}
- gruvbox.setup()
+ gruvbox.setup({ italic = true })
assert.are.same(gruvbox.config, expected)
end)
@@ -30,8 +41,13 @@ describe("setup", function()
undercurl = false,
underline = false,
bold = true,
+ italic = {
+ strings = true,
+ comments = true,
+ operators = false,
+ folds = true,
+ },
strikethrough = true,
- italic = true,
inverse = true,
invert_selection = false,
invert_signs = false,