mirror of
https://github.com/rose-pine/neovim.git
synced 2025-10-15 12:38:53 +02:00
feat: add new treesitter highlight groups
This commit is contained in:
parent
42390dfc01
commit
557b4faaf6
4 changed files with 234 additions and 102 deletions
|
|
@ -21,7 +21,64 @@ local function set_highlights()
|
||||||
return { fg = styles.bold and palette.text or fg, bold = styles.bold }
|
return { fg = styles.bold and palette.text or fg, bold = styles.bold }
|
||||||
end
|
end
|
||||||
|
|
||||||
local highlights = {
|
local highlights = {}
|
||||||
|
local legacy_highlights = {
|
||||||
|
["@attribute.diff"] = { fg = palette.gold },
|
||||||
|
["@boolean"] = { link = "Boolean" },
|
||||||
|
["@class"] = { fg = palette.foam },
|
||||||
|
["@conditional"] = { link = "Conditional" },
|
||||||
|
["@field"] = { fg = palette.foam },
|
||||||
|
["@include"] = { link = "Include" },
|
||||||
|
["@interface"] = { fg = palette.foam },
|
||||||
|
["@macro"] = { link = "Macro" },
|
||||||
|
["@method"] = { fg = palette.rose },
|
||||||
|
["@namespace"] = { link = "Include" },
|
||||||
|
["@number"] = { link = "Number" },
|
||||||
|
["@parameter"] = { fg = palette.iris, italic = styles.italic },
|
||||||
|
["@preproc"] = { link = "PreProc" },
|
||||||
|
["@punctuation"] = { fg = palette.subtle },
|
||||||
|
["@punctuation.bracket"] = { link = "@punctuation" },
|
||||||
|
["@punctuation.delimiter"] = { link = "@punctuation" },
|
||||||
|
["@punctuation.special"] = { link = "@punctuation" },
|
||||||
|
["@regexp"] = { link = "String" },
|
||||||
|
["@repeat"] = { link = "Repeat" },
|
||||||
|
["@storageclass"] = { link = "StorageClass" },
|
||||||
|
["@symbol"] = { link = "Identifier" },
|
||||||
|
["@text"] = { fg = palette.text },
|
||||||
|
["@text.danger"] = { fg = groups.error },
|
||||||
|
["@text.diff.add"] = { fg = groups.git_add, bg = groups.git_add, blend = 20 },
|
||||||
|
["@text.diff.delete"] = { fg = groups.git_delete, bg = groups.git_delete, blend = 20 },
|
||||||
|
["@text.emphasis"] = { italic = styles.italic },
|
||||||
|
["@text.environment"] = { link = "Macro" },
|
||||||
|
["@text.environment.name"] = { link = "Type" },
|
||||||
|
["@text.math"] = { link = "Special" },
|
||||||
|
["@text.note"] = { link = "SpecialComment" },
|
||||||
|
["@text.strike"] = { strikethrough = true },
|
||||||
|
["@text.strong"] = { bold = styles.bold },
|
||||||
|
["@text.title"] = { link = "Title" },
|
||||||
|
["@text.title.1.markdown"] = { link = "markdownH1" },
|
||||||
|
["@text.title.1.marker.markdown"] = { link = "markdownH1Delimiter" },
|
||||||
|
["@text.title.2.markdown"] = { link = "markdownH2" },
|
||||||
|
["@text.title.2.marker.markdown"] = { link = "markdownH2Delimiter" },
|
||||||
|
["@text.title.3.markdown"] = { link = "markdownH3" },
|
||||||
|
["@text.title.3.marker.markdown"] = { link = "markdownH3Delimiter" },
|
||||||
|
["@text.title.4.markdown"] = { link = "markdownH4" },
|
||||||
|
["@text.title.4.marker.markdown"] = { link = "markdownH4Delimiter" },
|
||||||
|
["@text.title.5.markdown"] = { link = "markdownH5" },
|
||||||
|
["@text.title.5.marker.markdown"] = { link = "markdownH5Delimiter" },
|
||||||
|
["@text.title.6.markdown"] = { link = "markdownH6" },
|
||||||
|
["@text.title.6.marker.markdown"] = { link = "markdownH6Delimiter" },
|
||||||
|
["@text.underline"] = { underline = true },
|
||||||
|
["@text.uri"] = { fg = groups.link },
|
||||||
|
["@text.warning"] = { fg = groups.warn },
|
||||||
|
["@todo"] = { link = "Todo" },
|
||||||
|
|
||||||
|
-- lukas-reineke/indent-blankline.nvim
|
||||||
|
IndentBlanklineChar = { fg = palette.muted, nocombine = true },
|
||||||
|
IndentBlanklineSpaceChar = { fg = palette.muted, nocombine = true },
|
||||||
|
IndentBlanklineSpaceCharBlankline = { fg = palette.muted, nocombine = true },
|
||||||
|
}
|
||||||
|
local default_highlights = {
|
||||||
ColorColumn = { bg = palette.surface },
|
ColorColumn = { bg = palette.surface },
|
||||||
Conceal = { bg = "NONE" },
|
Conceal = { bg = "NONE" },
|
||||||
CurSearch = { fg = palette.base, bg = palette.gold },
|
CurSearch = { fg = palette.base, bg = palette.gold },
|
||||||
|
|
@ -157,7 +214,7 @@ local function set_highlights()
|
||||||
String = { fg = palette.gold },
|
String = { fg = palette.gold },
|
||||||
Structure = { fg = palette.foam },
|
Structure = { fg = palette.foam },
|
||||||
Tag = { fg = palette.foam },
|
Tag = { fg = palette.foam },
|
||||||
Todo = { fg = palette.iris, bg = palette.iris, blend = 20 },
|
Todo = { fg = palette.rose, bg = palette.rose, blend = 20 },
|
||||||
Type = { fg = palette.foam },
|
Type = { fg = palette.foam },
|
||||||
TypeDef = { link = "Type" },
|
TypeDef = { link = "Type" },
|
||||||
Underlined = { fg = palette.iris, underline = true },
|
Underlined = { fg = palette.iris, underline = true },
|
||||||
|
|
@ -209,93 +266,144 @@ local function set_highlights()
|
||||||
mkdRule = { fg = palette.subtle },
|
mkdRule = { fg = palette.subtle },
|
||||||
mkdURL = { link = "markdownUrl" },
|
mkdURL = { link = "markdownUrl" },
|
||||||
|
|
||||||
["@attribute.diff"] = { fg = palette.gold },
|
--- Identifiers
|
||||||
["@boolean"] = { link = "Boolean" },
|
["@variable"] = { fg = palette.text, italic = styles.italic },
|
||||||
|
["@variable.builtin"] = { fg = palette.text, bold = styles.bold },
|
||||||
|
["@variable.parameter"] = { fg = palette.iris, italic = styles.italic },
|
||||||
|
["@variable.member"] = { fg = palette.foam },
|
||||||
|
|
||||||
|
["@constant"] = { fg = palette.gold },
|
||||||
|
["@constant.builtin"] = { fg = palette.gold, bold = styles.bold },
|
||||||
|
["@constant.macro"] = { fg = palette.gold },
|
||||||
|
|
||||||
|
["@module"] = { fg = palette.text },
|
||||||
|
["@module.builtin"] = { fg = palette.text, bold = styles.bold },
|
||||||
|
["@label"] = { link = "Label" },
|
||||||
|
|
||||||
|
--- Literals
|
||||||
|
["@string"] = { link = "String" },
|
||||||
|
-- ["@string.documentation"] = {},
|
||||||
|
["@string.regexp"] = { fg = palette.iris },
|
||||||
|
["@string.escape"] = { fg = palette.pine },
|
||||||
|
["@string.special"] = { link = "String" },
|
||||||
|
["@string.special.symbol"] = { link = "Identifier" },
|
||||||
|
["@string.special.url"] = { fg = groups.link },
|
||||||
|
-- ["@string.special.path"] = {},
|
||||||
|
|
||||||
["@character"] = { link = "Character" },
|
["@character"] = { link = "Character" },
|
||||||
["@character.special"] = { link = "Character" },
|
["@character.special"] = { link = "Character" },
|
||||||
["@class"] = { fg = palette.foam },
|
|
||||||
["@comment"] = { link = "Comment" },
|
["@boolean"] = { link = "Boolean" },
|
||||||
["@conditional"] = { link = "Conditional" },
|
["@number"] = { link = "Number" },
|
||||||
["@constant"] = { link = "Constant" },
|
["@number.float"] = { link = "Number" },
|
||||||
["@constant.builtin"] = { fg = palette.love },
|
|
||||||
["@constant.macro"] = { link = "Constant" },
|
--- Types
|
||||||
["@constructor"] = { fg = palette.foam },
|
["@type"] = { fg = palette.foam },
|
||||||
["@field"] = { fg = palette.foam },
|
["@type.builtin"] = { fg = palette.foam, bold = styles.bold },
|
||||||
["@function"] = { link = "Function" },
|
-- ["@type.definition"] = {},
|
||||||
["@function.builtin"] = { fg = palette.love },
|
-- ["@type.qualifier"] = {},
|
||||||
|
|
||||||
|
-- ["@attribute"] = {},
|
||||||
|
["@property"] = { fg = palette.foam, italic = styles.italic },
|
||||||
|
|
||||||
|
--- Functions
|
||||||
|
["@function"] = { fg = palette.rose },
|
||||||
|
["@function.builtin"] = { fg = palette.rose, bold = styles.bold },
|
||||||
|
-- ["@function.call"] = {},
|
||||||
["@function.macro"] = { link = "Function" },
|
["@function.macro"] = { link = "Function" },
|
||||||
["@include"] = { link = "Include" },
|
["@function.method"] = { fg = palette.rose },
|
||||||
["@interface"] = { fg = palette.foam },
|
["@function.method.call"] = { fg = palette.iris },
|
||||||
|
|
||||||
|
["@constructor"] = { fg = palette.foam },
|
||||||
|
["@operator"] = { link = "Operator" },
|
||||||
|
|
||||||
|
--- Keywords
|
||||||
["@keyword"] = { link = "Keyword" },
|
["@keyword"] = { link = "Keyword" },
|
||||||
|
-- ["@keyword.coroutine"] = {},
|
||||||
|
-- ["@keyword.function"] = {},
|
||||||
["@keyword.operator"] = { fg = palette.subtle },
|
["@keyword.operator"] = { fg = palette.subtle },
|
||||||
["@label"] = { link = "Label" },
|
["@keyword.import"] = { fg = palette.pine },
|
||||||
|
["@keyword.storage"] = { fg = palette.foam },
|
||||||
|
["@keyword.repeat"] = { fg = palette.pine },
|
||||||
|
["@keyword.return"] = { fg = palette.pine },
|
||||||
|
["@keyword.debug"] = { fg = palette.rose },
|
||||||
|
["@keyword.exception"] = { fg = palette.pine },
|
||||||
|
["@keyword.conditional"] = { fg = palette.pine },
|
||||||
|
["@keyword.conditional.ternary"] = { fg = palette.pine },
|
||||||
|
["@keyword.directive"] = { fg = palette.iris },
|
||||||
|
["@keyword.directive.define"] = { fg = palette.iris },
|
||||||
|
|
||||||
|
--- Punctuation
|
||||||
|
["@punctuation.delimiter"] = { fg = palette.subtle },
|
||||||
|
["@punctuation.bracket"] = { fg = palette.subtle },
|
||||||
|
["@punctuation.special"] = { fg = palette.subtle },
|
||||||
|
|
||||||
|
--- Comments
|
||||||
|
["@comment"] = { link = "Comment" },
|
||||||
|
-- ["@comment.documentation"] = {},
|
||||||
|
|
||||||
|
["@comment.error"] = { fg = groups.error },
|
||||||
|
["@comment.warning"] = { fg = groups.warn },
|
||||||
|
["@comment.todo"] = { fg = groups.todo, bg = groups.todo, blend = 20 },
|
||||||
|
["@comment.hint"] = { fg = groups.hint, bg = groups.hint, blend = 20 },
|
||||||
|
["@comment.info"] = { fg = groups.info, bg = groups.info, blend = 20 },
|
||||||
|
["@comment.note"] = { fg = groups.note, bg = groups.note, blend = 20 },
|
||||||
|
|
||||||
|
--- Markup
|
||||||
|
["@markup.strong"] = { bold = styles.bold },
|
||||||
|
["@markup.italic"] = { italic = styles.italic },
|
||||||
|
["@markup.strikethrough"] = { strikethrough = true },
|
||||||
|
["@markup.underline"] = { underline = true },
|
||||||
|
|
||||||
|
["@markup.heading"] = make_title(),
|
||||||
|
|
||||||
|
["@markup.quote"] = { fg = palette.subtle },
|
||||||
|
["@markup.math"] = { link = "Special" },
|
||||||
|
["@markup.environment"] = { link = "Macro" },
|
||||||
|
["@markup.environment.name"] = { link = "@type" },
|
||||||
|
|
||||||
|
-- ["@markup.link"] = {},
|
||||||
|
["@markup.link.label"] = { fg = palette.text },
|
||||||
|
["@markup.link.url"] = { fg = groups.link },
|
||||||
|
|
||||||
|
-- ["@markup.raw"] = { bg = palette.surface },
|
||||||
|
-- ["@markup.raw.block"] = { bg = palette.surface },
|
||||||
|
|
||||||
|
["@markup.list"] = { fg = palette.text },
|
||||||
|
["@markup.list.checked"] = { fg = palette.foam, bg = palette.foam, blend = 10 },
|
||||||
|
["@markup.list.unchecked"] = { fg = palette.text },
|
||||||
|
|
||||||
|
["@diff.plus"] = { fg = groups.git_add, bg = groups.git_add, blend = 20 },
|
||||||
|
["@diff.minus"] = { fg = groups.git_delete, bg = groups.git_delete, blend = 20 },
|
||||||
|
["@diff.delta"] = { bg = groups.git_change, blend = 20 },
|
||||||
|
|
||||||
|
["@tag"] = { link = "Tag" },
|
||||||
|
["@tag.attribute"] = { fg = palette.iris },
|
||||||
|
["@tag.delimiter"] = { fg = palette.subtle },
|
||||||
|
|
||||||
|
--- Non-highlighting captures
|
||||||
|
-- ["@none"] = {},
|
||||||
|
["@conceal"] = { link = "Conceal" },
|
||||||
|
|
||||||
|
-- ["@spell"] = {},
|
||||||
|
-- ["@nospell"] = {},
|
||||||
|
|
||||||
|
--- Semantic
|
||||||
["@lsp.type.comment"] = {},
|
["@lsp.type.comment"] = {},
|
||||||
["@lsp.type.enum"] = { link = "Type" },
|
["@lsp.type.enum"] = { link = "@type" },
|
||||||
["@lsp.type.interface"] = { link = "@interface" },
|
["@lsp.type.interface"] = { link = "@interface" },
|
||||||
["@lsp.type.keyword"] = { link = "Keyword" },
|
["@lsp.type.keyword"] = { link = "@keyword" },
|
||||||
["@lsp.type.namespace"] = { link = "@namespace" },
|
["@lsp.type.namespace"] = { link = "@namespace" },
|
||||||
["@lsp.type.parameter"] = { link = "@parameter" },
|
["@lsp.type.parameter"] = { link = "@parameter" },
|
||||||
["@lsp.type.property"] = { link = "@property" },
|
["@lsp.type.property"] = { link = "@property" },
|
||||||
["@lsp.type.variable"] = {},
|
["@lsp.type.variable"] = {},
|
||||||
["@lsp.typemod.function.defaultLibrary"] = { link = "Special" },
|
["@lsp.typemod.function.defaultLibrary"] = { link = "@function.builtin" },
|
||||||
["@lsp.typemod.operator.injected"] = { link = "Operator" },
|
["@lsp.typemod.operator.injected"] = { link = "@operator" },
|
||||||
["@lsp.typemod.string.injected"] = { link = "String" },
|
["@lsp.typemod.string.injected"] = { link = "@string" },
|
||||||
["@lsp.typemod.variable.defaultLibrary"] = { link = "@variable.builtin" },
|
["@lsp.typemod.variable.defaultLibrary"] = { link = "@variable.builtin" },
|
||||||
["@lsp.typemod.variable.injected"] = { link = "@variable" },
|
["@lsp.typemod.variable.injected"] = { link = "@variable" },
|
||||||
["@macro"] = { link = "Macro" },
|
|
||||||
["@method"] = { fg = palette.rose },
|
|
||||||
["@namespace"] = { link = "Include" },
|
|
||||||
["@number"] = { link = "Number" },
|
|
||||||
["@operator"] = { link = "Operator" },
|
|
||||||
["@parameter"] = { fg = palette.iris, italic = styles.italic },
|
|
||||||
["@preproc"] = { link = "PreProc" },
|
|
||||||
["@property"] = { fg = palette.foam, italic = styles.italic },
|
|
||||||
["@punctuation"] = { fg = palette.subtle },
|
|
||||||
["@punctuation.bracket"] = { link = "@punctuation" },
|
|
||||||
["@punctuation.delimiter"] = { link = "@punctuation" },
|
|
||||||
["@punctuation.special"] = { link = "@punctuation" },
|
|
||||||
["@regexp"] = { link = "String" },
|
|
||||||
["@repeat"] = { link = "Repeat" },
|
|
||||||
["@storageclass"] = { link = "StorageClass" },
|
|
||||||
["@string"] = { link = "String" },
|
|
||||||
["@string.escape"] = { fg = palette.pine },
|
|
||||||
["@string.special"] = { link = "String" },
|
|
||||||
["@symbol"] = { link = "Identifier" },
|
|
||||||
["@tag"] = { link = "Tag" },
|
|
||||||
["@tag.attribute"] = { fg = palette.iris },
|
|
||||||
["@tag.delimiter"] = { fg = palette.subtle },
|
|
||||||
["@text"] = { fg = palette.text },
|
|
||||||
["@text.danger"] = { fg = groups.error },
|
|
||||||
["@text.diff.add"] = { fg = groups.git_add, bg = groups.git_add, blend = 20 },
|
|
||||||
["@text.diff.delete"] = { fg = groups.git_delete, bg = groups.git_delete, blend = 20 },
|
|
||||||
["@text.emphasis"] = { italic = styles.italic },
|
|
||||||
["@text.environment"] = { link = "Macro" },
|
|
||||||
["@text.environment.name"] = { link = "Type" },
|
|
||||||
["@text.math"] = { link = "Special" },
|
|
||||||
["@text.note"] = { link = "SpecialComment" },
|
|
||||||
["@text.strike"] = { strikethrough = true },
|
|
||||||
["@text.strong"] = { bold = styles.bold },
|
|
||||||
["@text.title"] = { link = "Title" },
|
|
||||||
["@text.title.1.markdown"] = { link = "markdownH1" },
|
|
||||||
["@text.title.1.marker.markdown"] = { link = "markdownH1Delimiter" },
|
|
||||||
["@text.title.2.markdown"] = { link = "markdownH2" },
|
|
||||||
["@text.title.2.marker.markdown"] = { link = "markdownH2Delimiter" },
|
|
||||||
["@text.title.3.markdown"] = { link = "markdownH3" },
|
|
||||||
["@text.title.3.marker.markdown"] = { link = "markdownH3Delimiter" },
|
|
||||||
["@text.title.4.markdown"] = { link = "markdownH4" },
|
|
||||||
["@text.title.4.marker.markdown"] = { link = "markdownH4Delimiter" },
|
|
||||||
["@text.title.5.markdown"] = { link = "markdownH5" },
|
|
||||||
["@text.title.5.marker.markdown"] = { link = "markdownH5Delimiter" },
|
|
||||||
["@text.title.6.markdown"] = { link = "markdownH6" },
|
|
||||||
["@text.title.6.marker.markdown"] = { link = "markdownH6Delimiter" },
|
|
||||||
["@text.underline"] = { underline = true },
|
|
||||||
["@text.uri"] = { fg = groups.link },
|
|
||||||
["@text.warning"] = { fg = groups.warn },
|
|
||||||
["@todo"] = { link = "Todo" },
|
|
||||||
["@type"] = { link = "Type" },
|
|
||||||
["@variable"] = { fg = palette.text, italic = styles.italic },
|
|
||||||
["@variable.builtin"] = { fg = palette.love },
|
|
||||||
|
|
||||||
|
--- Plugins
|
||||||
-- romgrk/barbar.nvim
|
-- romgrk/barbar.nvim
|
||||||
BufferCurrent = { fg = palette.text, bg = palette.overlay },
|
BufferCurrent = { fg = palette.text, bg = palette.overlay },
|
||||||
BufferCurrentIndex = { fg = palette.text, bg = palette.overlay },
|
BufferCurrentIndex = { fg = palette.text, bg = palette.overlay },
|
||||||
|
|
@ -379,11 +487,6 @@ local function set_highlights()
|
||||||
IblScope = { fg = palette.foam },
|
IblScope = { fg = palette.foam },
|
||||||
IblWhitespace = { fg = palette.overlay },
|
IblWhitespace = { fg = palette.overlay },
|
||||||
|
|
||||||
-- for legacy usage
|
|
||||||
IndentBlanklineChar = { fg = palette.muted, nocombine = true },
|
|
||||||
IndentBlanklineSpaceChar = { fg = palette.muted, nocombine = true },
|
|
||||||
IndentBlanklineSpaceCharBlankline = { fg = palette.muted, nocombine = true },
|
|
||||||
|
|
||||||
-- hrsh7th/nvim-cmp
|
-- hrsh7th/nvim-cmp
|
||||||
CmpItemAbbr = { fg = palette.subtle },
|
CmpItemAbbr = { fg = palette.subtle },
|
||||||
CmpItemAbbrDeprecated = { fg = palette.subtle, strikethrough = true },
|
CmpItemAbbrDeprecated = { fg = palette.subtle, strikethrough = true },
|
||||||
|
|
@ -608,7 +711,6 @@ local function set_highlights()
|
||||||
-- github/copilot.vim
|
-- github/copilot.vim
|
||||||
CopilotSuggestion = { fg = palette.muted, italic = styles.italic },
|
CopilotSuggestion = { fg = palette.muted, italic = styles.italic },
|
||||||
}
|
}
|
||||||
|
|
||||||
local transparency_highlights = {
|
local transparency_highlights = {
|
||||||
DiagnosticVirtualTextError = { fg = groups.error },
|
DiagnosticVirtualTextError = { fg = groups.error },
|
||||||
DiagnosticVirtualTextHint = { fg = groups.hint },
|
DiagnosticVirtualTextHint = { fg = groups.hint },
|
||||||
|
|
@ -628,6 +730,9 @@ local function set_highlights()
|
||||||
TabLineFill = { bg = "NONE" },
|
TabLineFill = { bg = "NONE" },
|
||||||
TabLineSel = { fg = palette.text, bg = "NONE", bold = styles.bold },
|
TabLineSel = { fg = palette.text, bg = "NONE", bold = styles.bold },
|
||||||
|
|
||||||
|
-- ["@markup.raw"] = { bg = "none" },
|
||||||
|
-- ["@markup.raw.block"] = { bg = "none" },
|
||||||
|
|
||||||
TelescopeNormal = { fg = palette.subtle, bg = "NONE" },
|
TelescopeNormal = { fg = palette.subtle, bg = "NONE" },
|
||||||
TelescopePromptNormal = { fg = palette.text, bg = "NONE" },
|
TelescopePromptNormal = { fg = palette.text, bg = "NONE" },
|
||||||
TelescopeSelection = { fg = palette.text, bg = "NONE", bold = styles.bold },
|
TelescopeSelection = { fg = palette.text, bg = "NONE", bold = styles.bold },
|
||||||
|
|
@ -645,31 +750,41 @@ local function set_highlights()
|
||||||
MiniPickPrompt = { bg = "NONE", bold = styles.bold },
|
MiniPickPrompt = { bg = "NONE", bold = styles.bold },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.options.enable.legacy_highlights then
|
||||||
|
for group, highlight in pairs(legacy_highlights) do
|
||||||
|
highlights[group] = highlight
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for group, highlight in pairs(default_highlights) do
|
||||||
|
highlights[group] = highlight
|
||||||
|
end
|
||||||
if styles.transparency then
|
if styles.transparency then
|
||||||
for group, highlight in pairs(transparency_highlights) do
|
for group, highlight in pairs(transparency_highlights) do
|
||||||
highlights[group] = highlight
|
highlights[group] = highlight
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if config.options.highlight_groups ~= nil and next(config.options.highlight_groups) ~= nil then
|
||||||
|
vim.print(config.options.highlight_groups)
|
||||||
|
for group, options in pairs(config.options.highlight_groups) do
|
||||||
|
local default_opts = highlights[group] or {}
|
||||||
|
|
||||||
for group, options in pairs(config.options.highlight_groups) do
|
if (options.inherit == nil or options.inherit) and default_opts ~= nil then
|
||||||
local default_opts = highlights[group] or {}
|
options.inherit = nil
|
||||||
|
highlights[group] = vim.tbl_extend("force", default_opts, options)
|
||||||
|
else
|
||||||
|
options.inherit = nil
|
||||||
|
highlights[group] = options
|
||||||
|
end
|
||||||
|
|
||||||
if (options.inherit == nil or options.inherit) and default_opts ~= nil then -- On merge.
|
highlights[group] = vim.tbl_extend("force", highlights[group] or {}, options)
|
||||||
options.inherit = nil -- Don't add this key to the highlight_group after merge.
|
|
||||||
highlights[group] = vim.tbl_extend("force", default_opts, options)
|
|
||||||
else -- On overwrite.
|
|
||||||
options.inherit = nil -- Don't add this key to the highlight_group.
|
|
||||||
highlights[group] = options
|
|
||||||
end
|
end
|
||||||
|
|
||||||
highlights[group] = vim.tbl_extend("force", highlights[group] or {}, options)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for group, highlight in pairs(highlights) do
|
for group, highlight in pairs(highlights) do
|
||||||
config.options.before_highlight(group, highlight, palette)
|
config.options.before_highlight(group, highlight, palette)
|
||||||
utilities.highlight(group, highlight)
|
utilities.highlight(group, highlight)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Terminal
|
||||||
if config.options.enable.terminal then
|
if config.options.enable.terminal then
|
||||||
vim.g.terminal_color_0 = palette.overlay -- black
|
vim.g.terminal_color_0 = palette.overlay -- black
|
||||||
vim.g.terminal_color_8 = palette.subtle -- bright black
|
vim.g.terminal_color_8 = palette.subtle -- bright black
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
---@alias Variant "main" | "moon" | "dawn"
|
---@alias Variant "main" | "moon" | "dawn"
|
||||||
---@alias Palette { base: string, surface: string, overlay: string, muted: string, subtle: string, text: string, love: string, gold: string, rose: string, pine: string, foam: string, iris: string }
|
---@alias Palette { base: string, surface: string, overlay: string, muted: string, subtle: string, text: string, love: string, gold: string, rose: string, pine: string, foam: string, iris: string }
|
||||||
---@alias PaletteColor "base" | "surface" | "overlay" | "muted" | "subtle" | "text" | "love" | "gold" | "rose" | "pine" | "foam" | "iris" | "highlight_low" | "highlight_med" | "highlight_high"
|
---@alias PaletteColor "base" | "surface" | "overlay" | "muted" | "subtle" | "text" | "love" | "gold" | "rose" | "pine" | "foam" | "iris" | "highlight_low" | "highlight_med" | "highlight_high"
|
||||||
---@alias Highlight { fg: string, bg: string, sp: string, bold: boolean, italic: boolean, undercurl: boolean, underline: boolean, underdouble: boolean, underdotted: boolean, underdashed: boolean, strikethrough: boolean }
|
---@alias Highlight { fg: string, bg: string, sp: string, bold: boolean, italic: boolean, undercurl: boolean, underline: boolean, underdouble: boolean, underdotted: boolean, underdashed: boolean, strikethrough: boolean, inherit: boolean }
|
||||||
|
|
||||||
local config = {}
|
local config = {}
|
||||||
|
|
||||||
|
|
@ -24,8 +24,9 @@ config.options = {
|
||||||
extend_background_behind_borders = true,
|
extend_background_behind_borders = true,
|
||||||
|
|
||||||
enable = {
|
enable = {
|
||||||
terminal = true,
|
legacy_highlights = true,
|
||||||
migrations = true,
|
migrations = true,
|
||||||
|
terminal = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
styles = {
|
styles = {
|
||||||
|
|
@ -43,6 +44,8 @@ config.options = {
|
||||||
error = "love",
|
error = "love",
|
||||||
hint = "iris",
|
hint = "iris",
|
||||||
info = "foam",
|
info = "foam",
|
||||||
|
note = "pine",
|
||||||
|
todo = "rose",
|
||||||
warn = "gold",
|
warn = "gold",
|
||||||
|
|
||||||
git_add = "foam",
|
git_add = "foam",
|
||||||
|
|
@ -56,7 +59,7 @@ config.options = {
|
||||||
git_text = "rose",
|
git_text = "rose",
|
||||||
git_untracked = "subtle",
|
git_untracked = "subtle",
|
||||||
|
|
||||||
---@type string | PaletteColor | table<string, string | PaletteColor>
|
---@type table<string, string | PaletteColor>
|
||||||
headings = {
|
headings = {
|
||||||
h1 = "iris",
|
h1 = "iris",
|
||||||
h2 = "foam",
|
h2 = "foam",
|
||||||
|
|
@ -72,6 +75,8 @@ config.options = {
|
||||||
-- comment = "subtle",
|
-- comment = "subtle",
|
||||||
---@deprecated Replaced by `options.highlight_groups["@punctuation"]`
|
---@deprecated Replaced by `options.highlight_groups["@punctuation"]`
|
||||||
-- punctuation = "muted",
|
-- punctuation = "muted",
|
||||||
|
---@deprecated Expects a table with values h1...h6
|
||||||
|
-- headings = "text",
|
||||||
},
|
},
|
||||||
|
|
||||||
---@type table<string, Highlight>
|
---@type table<string, Highlight>
|
||||||
|
|
@ -103,6 +108,10 @@ local function migrate(options)
|
||||||
options.highlight_groups["WinSeparator"] = { fg = border, bg = border }
|
options.highlight_groups["WinSeparator"] = { fg = border, bg = border }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if options.disable_background then
|
||||||
|
options.highlight_groups["Normal"] = { bg = "NONE" }
|
||||||
|
end
|
||||||
|
|
||||||
if options.disable_float_background then
|
if options.disable_float_background then
|
||||||
options.highlight_groups["NormalFloat"] = { bg = "NONE" }
|
options.highlight_groups["NormalFloat"] = { bg = "NONE" }
|
||||||
end
|
end
|
||||||
|
|
@ -121,7 +130,8 @@ local function migrate(options)
|
||||||
options.highlight_groups["@punctuation"] = { fg = options.groups.punctuation }
|
options.highlight_groups["@punctuation"] = { fg = options.groups.punctuation }
|
||||||
end
|
end
|
||||||
|
|
||||||
options.styles.transparency = options.disable_background or options.styles.transparency
|
options.styles.transparency = (options.disable_background and options.disable_float_background)
|
||||||
|
or options.styles.transparency
|
||||||
|
|
||||||
-- These never actually existed, but may be set intuitively by the user
|
-- These never actually existed, but may be set intuitively by the user
|
||||||
-- because of `disable_italics` existing.
|
-- because of `disable_italics` existing.
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ function utilities.highlight(group, highlight, blend_on)
|
||||||
highlight.fg = fg
|
highlight.fg = fg
|
||||||
highlight.bg = bg
|
highlight.bg = bg
|
||||||
highlight.sp = sp
|
highlight.sp = sp
|
||||||
-- highlight = vim.tbl_extend("force", highlight, { fg = fg, bg = bg, sp = sp })
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, group, highlight)
|
vim.api.nvim_set_hl(0, group, highlight)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
14
readme.md
14
readme.md
|
|
@ -57,6 +57,14 @@ require('rose-pine').setup({
|
||||||
dim_inactive_windows = false,
|
dim_inactive_windows = false,
|
||||||
extend_background_behind_borders = true,
|
extend_background_behind_borders = true,
|
||||||
|
|
||||||
|
enable = {
|
||||||
|
terminal = true,
|
||||||
|
-- Improve compatibility for previous versions of Neovim
|
||||||
|
legacy_highlights = true,
|
||||||
|
-- Handle deprecated options automatically
|
||||||
|
migrations = true,
|
||||||
|
},
|
||||||
|
|
||||||
styles = {
|
styles = {
|
||||||
bold = true,
|
bold = true,
|
||||||
italic = true,
|
italic = true,
|
||||||
|
|
@ -71,6 +79,8 @@ require('rose-pine').setup({
|
||||||
error = "love",
|
error = "love",
|
||||||
hint = "iris",
|
hint = "iris",
|
||||||
info = "foam",
|
info = "foam",
|
||||||
|
note = "pine",
|
||||||
|
todo = "rose",
|
||||||
warn = "gold",
|
warn = "gold",
|
||||||
|
|
||||||
git_add = "foam",
|
git_add = "foam",
|
||||||
|
|
@ -92,8 +102,6 @@ require('rose-pine').setup({
|
||||||
h5 = "pine",
|
h5 = "pine",
|
||||||
h6 = "foam",
|
h6 = "foam",
|
||||||
},
|
},
|
||||||
-- Alternatively, set all headings at once.
|
|
||||||
-- headings = "subtle",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
highlight_groups = {
|
highlight_groups = {
|
||||||
|
|
@ -125,6 +133,6 @@ vim.cmd('colorscheme rose-pine')
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
We welcome and appreciate contributions of any kind. Create an issue or start a discussion for any proposed changes. Pull requests are encouraged for supporting additional plugins.
|
We welcome and appreciate contributions of any kind. Create an issue or start a discussion for any proposed changes. Pull requests are encouraged for supporting additional plugins or [treesitter improvements](https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#highlights).
|
||||||
|
|
||||||
Feel free to update the [wiki](https://github.com/rose-pine/neovim/wiki/) with any [recipes](https://github.com/rose-pine/neovim/wiki/Recipes).
|
Feel free to update the [wiki](https://github.com/rose-pine/neovim/wiki/) with any [recipes](https://github.com/rose-pine/neovim/wiki/Recipes).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue