refactor(nvim): overhaul highlights

This commit is contained in:
Price Hiller 2024-02-20 17:09:02 -06:00
parent dbd8fb2d20
commit eb98162264
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
3 changed files with 305 additions and 238 deletions

View File

@ -31,12 +31,24 @@
; Quote highlights ; Quote highlights
(block (block
name: (expr) @org-block-start-name (#any-of? @org-block-start-name "quote" "QUOTE") name: (expr) @org-block-start-name (#any-of? @org-block-start-name "quote" "QUOTE")
contents: (contents) @markup.quote contents: (contents) @markup.quote
end_name: (expr) @org-block-end-name (#any-of? @org-block-end-name "quote" "QUOTE")) end_name: (expr) @org-block-end-name (#any-of? @org-block-end-name "quote" "QUOTE"))
(block (block
name: (expr) @org-block-start-name (#any-of? @org-block-start-name "src" "SRC") name: (expr) @org-block-start-name (#any-of? @org-block-start-name "src" "SRC")
!parameter !parameter
contents: (contents) @markup.raw.block contents: (contents) @markup.raw.block
end_name: (expr) @org-block-end-name (#any-of? @org-block-end-name "src" "SRC")) end_name: (expr) @org-block-end-name (#any-of? @org-block-end-name "src" "SRC"))
; Improved timestamp highlights
(entry
timestamp:
(timestamp
("<" @org.timestamp.active.delimiter)
(">" @org.timestamp.active.delimiter)))
(entry
timestamp:
(timestamp
("[" @org.timestamp.inactive.delimiter)
("]" @org.timestamp.inactive.delimiter)))

View File

@ -38,42 +38,47 @@ return {
local palette = require("kanagawa.colors").setup() local palette = require("kanagawa.colors").setup()
local colors = require("kanagawa.colors").setup().palette local colors = require("kanagawa.colors").setup().palette
-- This table was formed as an array to ensure the ordering of the keys. Since some -- HACK: This table was formed as an array to ensure the ordering of the keys. Since some
-- highlights defined below depend on other highlights being correctly set, order is -- highlights defined below depend on other highlights being correctly set, order is
-- very important. Lua does not guarantee hashmaps will be in the order they are -- very important. Lua does not guarantee hashmaps will be in the order they are
-- defined, thus the array. -- defined, thus the array.
---@type { [1]: string, [2]: vim.api.keyset.highlight | fun(): vim.api.keyset.highlight }[] --
---@type { [1]: string, [2]: vim.api.keyset.highlight | fun(): vim.api.keyset.highlight | table<Highlight.Keys, fun(): string | integer> }[]
local extra_hls = { local extra_hls = {
{ "NvimNotifyError", { fg = colors.samuraiRed } }, { "NvimNotifyError", { fg = colors.samuraiRed } },
{ "NvimNotifyWarn", { fg = colors.roninYellow } }, { "NvimNotifyWarn", { fg = colors.roninYellow } },
{ "NvimNotifyInfo", { fg = colors.springGreen } }, { "NvimNotifyInfo", { fg = colors.springGreen } },
{ "NvimNotifyDebug", { fg = colors.crystalBlue } }, { "NvimNotifyDebug", { fg = colors.crystalBlue } },
{ "NvimNotifyTrace", { fg = colors.oniViolet } }, { "NvimNotifyTrace", { fg = colors.oniViolet } },
{ "Winbar", { bg = nil } }, { "Winbar", { bg = nil } },
{ "StatusLineNC", { bg = nil } }, { "StatusLineNC", { bg = nil } },
{ "WinBarNC", { bg = nil } }, { "WinBarNC", { bg = nil } },
{ "CursorLineNr", { fg = colors.roninYellow, bg = palette.theme.ui.bg_m1 } }, { "DiagnosticSignErrorCul", { link = "DiagnosticSignError" } },
{ "CursorLineFold", { fg = colors.crystalBlue, bg = palette.theme.ui.bg_m1 } }, { "DiagnosticSignWarnCul", { link = "DiagnosticSignWarn" } },
{ "CursorLineSign", { bg = palette.theme.ui.bg_m1 } }, { "DiagnosticSignInfoCul", { link = "DiagnosticSignInfo" } },
{ "LightBulbSign", { fg = colors.crystalBlue, bg = palette.theme.ui.bg_m1 } }, { "DiagnosticSignHintCul", { link = "DiagnosticSignHint" } },
{ "WinSeparator", { fg = colors.fujiGray } }, { "CursorLineNr", { fg = colors.roninYellow, bg = palette.theme.ui.bg_m1 } },
{ "StatusLine", { fg = colors.fujiWhite, bg = colors.sumiInk0 } }, { "CursorLineFold", { fg = colors.crystalBlue, bg = palette.theme.ui.bg_m1 } },
{ "WinBar", { fg = colors.fujiWhite, bg = nil } }, { "CursorLineSign", { bg = palette.theme.ui.bg_m1 } },
{ "NeogitPopupSectionTitle", { fg = colors.crystalBlue } }, { "LightBulbSign", { fg = colors.crystalBlue, bg = palette.theme.ui.bg_m1 } },
{ "NeogitPopupConfigEnabled", { fg = colors.springBlue, italic = true } }, { "WinSeparator", { fg = colors.fujiGray } },
{ "NeogitPopupActionkey", { fg = colors.surimiOrange } }, { "StatusLine", { fg = colors.fujiWhite, bg = colors.sumiInk0 } },
{ "NeogitPopupConfigKey", { fg = colors.peachRed } }, { "WinBar", { fg = colors.fujiWhite, bg = nil } },
{ "NeogitHunkHeader", { fg = colors.crystalBlue, bg = colors.sumiInk2 } }, { "NeogitPopupSectionTitle", { fg = colors.crystalBlue } },
{ "NeogitHunkHeaderHighlight", { fg = colors.roninYellow, bg = colors.sumiInk1 } }, { "NeogitPopupConfigEnabled", { fg = colors.springBlue, italic = true } },
{ "NeogitBranch", { fg = colors.autumnYellow, bold = true } }, { "NeogitPopupActionkey", { fg = colors.surimiOrange } },
{ "NeogitUnmergedInto", { fg = colors.surimiOrange, bold = true } }, { "NeogitPopupConfigKey", { fg = colors.peachRed } },
{ "NeogitRemote", { fg = colors.carpYellow, bold = true } }, { "NeogitHunkHeader", { fg = colors.crystalBlue, bg = colors.sumiInk2 } },
{ "NeogitDiffContext", { bg = colors.sumiInk3 } }, { "NeogitHunkHeaderHighlight", { fg = colors.roninYellow, bg = colors.sumiInk1 } },
{ "NeogitBranch", { fg = colors.autumnYellow, bold = true } },
{ "NeogitUnmergedInto", { fg = colors.surimiOrange, bold = true } },
{ "NeogitRemote", { fg = colors.carpYellow, bold = true } },
{ "NeogitDiffContext", { bg = colors.sumiInk3 } },
{ "NeogitDiffContextHighlight", { bg = colors.sumiInk4 } }, { "NeogitDiffContextHighlight", { bg = colors.sumiInk4 } },
{ "NeogitCursorLine", { link = "CursorLine" } }, { "NeogitCursorLine", { link = "CursorLine" } },
{ "NeogitDiffAdd", { fg = colors.autumnGreen, bg = colors.winterGreen } }, { "NeogitDiffAdd", { fg = colors.autumnGreen, bg = colors.winterGreen } },
{ "NeogitDiffDelete", { fg = colors.autumnRed, bg = colors.winterRed } }, { "NeogitDiffDelete", { fg = colors.autumnRed, bg = colors.winterRed } },
{ "NeogitDiffDeleteHighlight", { link = "DiffDelete" } }, { "NeogitDiffDeleteHighlight", { link = "DiffDelete" } },
{ {
"NeogitDiffHeader", "NeogitDiffHeader",
{ fg = colors.oniViolet, bg = colors.sumiInk0, bold = true }, { fg = colors.oniViolet, bg = colors.sumiInk0, bold = true },
@ -82,216 +87,259 @@ return {
"NeogitDiffHeaderHighlight", "NeogitDiffHeaderHighlight",
{ fg = colors.sakuraPink, bg = colors.sumiInk0, bold = true }, { fg = colors.sakuraPink, bg = colors.sumiInk0, bold = true },
}, },
{ "NeogitDiffAddHighlight", { link = "DiffAdd" } }, { "NeogitDiffAddHighlight", { link = "DiffAdd" } },
{ "NeogitStagedChanges", { fg = colors.surimiOrange, bold = true } }, { "NeogitStagedChanges", { fg = colors.surimiOrange, bold = true } },
{ "NeogitUnpulledChanges", { fg = colors.peachRed, bold = true } }, { "NeogitUnpulledChanges", { fg = colors.peachRed, bold = true } },
{ "NeogitUnmergedChanges", { fg = colors.springGreen, bold = true } }, { "NeogitUnmergedChanges", { fg = colors.springGreen, bold = true } },
{ "NeogitUnstagedChanges", { fg = colors.peachRed, bold = true } }, { "NeogitUnstagedChanges", { fg = colors.peachRed, bold = true } },
{ "NeogitUntrackedFiles", { fg = colors.peachRed, bold = true } }, { "NeogitUntrackedFiles", { fg = colors.peachRed, bold = true } },
{ "NeogitRecentCommits", { fg = colors.crystalBlue, bold = true } }, { "NeogitRecentCommits", { fg = colors.crystalBlue, bold = true } },
{ "NeogitCommitViewHeader", { fg = colors.crystalBlue, bold = true, italic = true } }, { "NeogitCommitViewHeader", { fg = colors.crystalBlue, bold = true, italic = true } },
{ "NeogitFilePath", { fg = colors.autumnYellow, italic = true } }, { "NeogitFilePath", { fg = colors.autumnYellow, italic = true } },
{ "NeogitNotificationInfo", { fg = colors.springGreen, bold = true } }, { "NeogitNotificationInfo", { fg = colors.springGreen, bold = true } },
{ "NeogitNotificationWarning", { fg = colors.roninYellow, bold = true } }, { "NeogitNotificationWarning", { fg = colors.roninYellow, bold = true } },
{ "NeogitNotificationError", { fg = colors.samuraiRed, bold = true } }, { "NeogitNotificationError", { fg = colors.samuraiRed, bold = true } },
{ "menuSel", { bg = colors.sumiInk0, fg = "NONE" } }, { "menuSel", { bg = colors.sumiInk0, fg = "NONE" } },
{ "Pmenu", { fg = colors.fujiWhite, bg = colors.sumiInk2 } }, { "Pmenu", { fg = colors.fujiWhite, bg = colors.sumiInk2 } },
{ "CmpGhostText", { fg = colors.boatYellow1, italic = true } }, { "CmpGhostText", { fg = colors.boatYellow1, italic = true } },
{ "CmpItemAbbrDeprecated", { fg = colors.fujiGray, bg = "NONE" } }, { "CmpItemAbbrDeprecated", { fg = colors.fujiGray, bg = "NONE" } },
{ "CmpItemAbbrMatch", { fg = colors.crystalBlue, bg = "NONE" } }, { "CmpItemAbbrMatch", { fg = colors.crystalBlue, bg = "NONE" } },
{ "CmpItemAbbrMatchFuzzy", { fg = colors.crystalBlue, bg = "NONE" } }, { "CmpItemAbbrMatchFuzzy", { fg = colors.crystalBlue, bg = "NONE" } },
{ "CmpItemMenu", { fg = colors.roninYellow, bg = "NONE" } }, { "CmpItemMenu", { fg = colors.roninYellow, bg = "NONE" } },
{ "CmpItemKindField", { fg = colors.fujiWhite, bg = colors.sakuraPink } }, { "CmpItemKindField", { fg = colors.fujiWhite, bg = colors.sakuraPink } },
{ "CmpItemKindProperty", { fg = colors.fujiWhite, bg = colors.sakuraPink } }, { "CmpItemKindProperty", { fg = colors.fujiWhite, bg = colors.sakuraPink } },
{ "CmpItemKindEvent", { fg = colors.fujiWhite, bg = colors.sakuraPink } }, { "CmpItemKindEvent", { fg = colors.fujiWhite, bg = colors.sakuraPink } },
{ "CmpItemKindText", { fg = colors.fujiWhite, bg = colors.dragonBlue } }, { "CmpItemKindText", { fg = colors.fujiWhite, bg = colors.dragonBlue } },
{ "CmpItemKindEnum", { fg = colors.fujiWhite, bg = colors.crystalBlue } }, { "CmpItemKindEnum", { fg = colors.fujiWhite, bg = colors.crystalBlue } },
{ "CmpItemKindKeyword", { fg = colors.fujiWhite, bg = colors.springBlue } }, { "CmpItemKindKeyword", { fg = colors.fujiWhite, bg = colors.springBlue } },
{ "CmpItemKindConstant", { fg = colors.fujiWhite, bg = colors.crystalBlue } }, { "CmpItemKindConstant", { fg = colors.fujiWhite, bg = colors.crystalBlue } },
{ "CmpItemKindConstructor", { fg = colors.fujiWhite, bg = colors.crystalBlue } }, { "CmpItemKindConstructor", { fg = colors.fujiWhite, bg = colors.crystalBlue } },
{ "CmpItemKindReference", { fg = colors.fujiWhite, bg = colors.crystalBlue } }, { "CmpItemKindReference", { fg = colors.fujiWhite, bg = colors.crystalBlue } },
{ "CmpItemKindFunction", { fg = colors.fujiWhite, bg = colors.oniViolet } }, { "CmpItemKindFunction", { fg = colors.fujiWhite, bg = colors.oniViolet } },
{ "CmpItemKindStruct", { fg = colors.fujiWhite, bg = colors.oniViolet } }, { "CmpItemKindStruct", { fg = colors.fujiWhite, bg = colors.oniViolet } },
{ "CmpItemKindClass", { fg = colors.fujiWhite, bg = colors.oniViolet } }, { "CmpItemKindClass", { fg = colors.fujiWhite, bg = colors.oniViolet } },
{ "CmpItemKindModule", { fg = colors.fujiWhite, bg = colors.oniViolet } }, { "CmpItemKindModule", { fg = colors.fujiWhite, bg = colors.oniViolet } },
{ "CmpItemKindOperator", { fg = colors.fujiWhite, bg = colors.oniViolet } }, { "CmpItemKindOperator", { fg = colors.fujiWhite, bg = colors.oniViolet } },
{ "CmpItemKindVariable", { fg = colors.fujiWhite, bg = colors.roninYellow } }, { "CmpItemKindVariable", { fg = colors.fujiWhite, bg = colors.roninYellow } },
{ "CmpItemKindFile", { fg = colors.fujiWhite, bg = colors.autumnYellow } }, { "CmpItemKindFile", { fg = colors.fujiWhite, bg = colors.autumnYellow } },
{ "CmpItemKindUnit", { fg = colors.fujiWhite, bg = colors.autumnYellow } }, { "CmpItemKindUnit", { fg = colors.fujiWhite, bg = colors.autumnYellow } },
{ "CmpItemKindSnippet", { fg = colors.fujiWhite, bg = colors.autumnYellow } }, { "CmpItemKindSnippet", { fg = colors.fujiWhite, bg = colors.autumnYellow } },
{ "CmpItemKindFolder", { fg = colors.fujiWhite, bg = colors.autumnYellow } }, { "CmpItemKindFolder", { fg = colors.fujiWhite, bg = colors.autumnYellow } },
{ "CmpItemKindMethod", { fg = colors.fujiWhite, bg = colors.autumnGreen } }, { "CmpItemKindMethod", { fg = colors.fujiWhite, bg = colors.autumnGreen } },
{ "CmpItemKindValue", { fg = colors.fujiWhite, bg = colors.autumnGreen } }, { "CmpItemKindValue", { fg = colors.fujiWhite, bg = colors.autumnGreen } },
{ "CmpItemKindEnumMember", { fg = colors.fujiWhite, bg = colors.autumnGreen } }, { "CmpItemKindEnumMember", { fg = colors.fujiWhite, bg = colors.autumnGreen } },
{ "CmpItemKindInterface", { fg = colors.fujiWhite, bg = colors.waveRed } }, { "CmpItemKindInterface", { fg = colors.fujiWhite, bg = colors.waveRed } },
{ "CmpItemKindColor", { fg = colors.fujiWhite, bg = colors.waveAqua2 } }, { "CmpItemKindColor", { fg = colors.fujiWhite, bg = colors.waveAqua2 } },
{ "CmpItemKindTypeParameter", { fg = colors.fujiWhite, bg = colors.waveAqua2 } }, { "CmpItemKindTypeParameter", { fg = colors.fujiWhite, bg = colors.waveAqua2 } },
{ "CmpCustomSelectionColor", { bg = colors.sumiInk5 } }, { "CmpCustomSelectionColor", { bg = colors.sumiInk5 } },
{ "CmpCustomSelectionDadbodCompletion", { fg = colors.fujiWhite, bg = colors.oniViolet } }, { "CmpCustomSelectionDadbodCompletion", { fg = colors.fujiWhite, bg = colors.oniViolet } },
{ "CmpCustomSelectionGit", { fg = colors.fujiWhite, bg = colors.roninYellow } }, { "CmpCustomSelectionGit", { fg = colors.fujiWhite, bg = colors.roninYellow } },
{ "CmpCustomSelectionBuffer", { fg = colors.fujiWhite, bg = colors.springBlue } }, { "CmpCustomSelectionBuffer", { fg = colors.fujiWhite, bg = colors.springBlue } },
{ "CmpCustomSelectionPath", { fg = colors.fujiWhite, bg = colors.autumnYellow } }, { "CmpCustomSelectionPath", { fg = colors.fujiWhite, bg = colors.autumnYellow } },
{ "CmpCustomSelectionCalculator", { fg = colors.fujiWhite, bg = colors.waveBlue2 } }, { "CmpCustomSelectionCalculator", { fg = colors.fujiWhite, bg = colors.waveBlue2 } },
{ "CmpCustomSelectionOrgmode", { fg = colors.fujiWhite, bg = colors.waveAqua1 } }, { "CmpCustomSelectionOrgmode", { fg = colors.fujiWhite, bg = colors.waveAqua1 } },
{ "CmpCustomSelectionEmoji", { fg = colors.fujiWhite, bg = colors.carpYellow } }, { "CmpCustomSelectionEmoji", { fg = colors.fujiWhite, bg = colors.carpYellow } },
{ "CmpCustomSelectionZsh", { fg = colors.fujiWhite, bg = colors.springGreen } }, { "CmpCustomSelectionZsh", { fg = colors.fujiWhite, bg = colors.springGreen } },
{ "CmpCustomSelectionCrates", { fg = colors.fujiWhite, bg = colors.roninYellow } }, { "CmpCustomSelectionCrates", { fg = colors.fujiWhite, bg = colors.roninYellow } },
{ "CmpCustomSelectionDocker", { fg = colors.fujiWhite, bg = colors.springBlue } }, { "CmpCustomSelectionDocker", { fg = colors.fujiWhite, bg = colors.springBlue } },
{ "CmpCustomSelectionCmdHistory", { fg = colors.fujiWhite, bg = colors.waveBlue2 } }, { "CmpCustomSelectionCmdHistory", { fg = colors.fujiWhite, bg = colors.waveBlue2 } },
{ "CmpCustomSelectionRipgrep", { fg = colors.fujiWhite, bg = colors.crystalBlue } }, { "CmpCustomSelectionRipgrep", { fg = colors.fujiWhite, bg = colors.crystalBlue } },
{ "CmpCustomSelectionNpm", { fg = colors.fujiWhite, bg = colors.peachRed } }, { "CmpCustomSelectionNpm", { fg = colors.fujiWhite, bg = colors.peachRed } },
{ "CmpCustomSelectionCommit", { fg = colors.fujiWhite, bg = colors.peachRed } }, { "CmpCustomSelectionCommit", { fg = colors.fujiWhite, bg = colors.peachRed } },
{ "CmpCustomSelectionSnippet", { fg = colors.fujiWhite, bg = colors.peachRed } }, { "CmpCustomSelectionSnippet", { fg = colors.fujiWhite, bg = colors.peachRed } },
{ "CmpCustomSelectionLuaLatexSymbol", { fg = colors.fujiWhite, bg = colors.surimiOrange } }, { "CmpCustomSelectionLuaLatexSymbol", { fg = colors.fujiWhite, bg = colors.surimiOrange } },
{ "TelescopeNormal", { bg = colors.sumiInk2 } }, { "TelescopeNormal", { bg = colors.sumiInk2 } },
{ "TelescopeBorder", { bg = colors.sumiInk2, fg = colors.sumiInk1 } }, { "TelescopeBorder", { bg = colors.sumiInk2, fg = colors.sumiInk1 } },
{ "TelescopePromptBorder", { bg = colors.sumiInk0, fg = colors.sumiInk0 } }, { "TelescopePromptBorder", { bg = colors.sumiInk0, fg = colors.sumiInk0 } },
{ "TelescopePromptNormal", { bg = colors.sumiInk0, fg = colors.fujiWhite } }, { "TelescopePromptNormal", { bg = colors.sumiInk0, fg = colors.fujiWhite } },
{ "TelescopePromptTitle", { fg = colors.sumiInk0, bg = colors.oniViolet } }, { "TelescopePromptTitle", { fg = colors.sumiInk0, bg = colors.oniViolet } },
{ "TelescopePreviewTitle", { fg = colors.sumiInk0, bg = colors.sakuraPink } }, { "TelescopePreviewTitle", { fg = colors.sumiInk0, bg = colors.sakuraPink } },
{ "TelescopePreviewNormal", { bg = colors.sumiInk4 } }, { "TelescopePreviewNormal", { bg = colors.sumiInk4 } },
{ "TelescopePreviewBorder", { link = "TelescopePreviewNormal" } }, { "TelescopePreviewBorder", { link = "TelescopePreviewNormal" } },
{ "TelescopeResultsTitle", { fg = "NONE", bg = "NONE" } }, { "TelescopeResultsTitle", { fg = "NONE", bg = "NONE" } },
{ "MiniCursorword", { bg = colors.waveBlue2 } }, { "MiniCursorword", { bg = colors.waveBlue2 } },
{ "MiniCursorwordCurrent", { bg = colors.waveBlue2 } }, { "MiniCursorwordCurrent", { bg = colors.waveBlue2 } },
{ "rainbowcol1", { fg = colors.oniViolet } }, { "rainbowcol1", { fg = colors.oniViolet } },
{ "rainbowcol2", { fg = colors.crystalBlue } }, { "rainbowcol2", { fg = colors.crystalBlue } },
{ "rainbowcol3", { fg = colors.lightBlue } }, { "rainbowcol3", { fg = colors.lightBlue } },
{ "rainbowcol4", { fg = colors.sakuraPink } }, { "rainbowcol4", { fg = colors.sakuraPink } },
{ "rainbowcol5", { fg = colors.springGreen } }, { "rainbowcol5", { fg = colors.springGreen } },
{ "rainbowcol6", { fg = colors.springViolet2 } }, { "rainbowcol6", { fg = colors.springViolet2 } },
{ "rainbowcol7", { fg = colors.carpYellow } }, { "rainbowcol7", { fg = colors.carpYellow } },
{ "packerSuccess", { fg = colors.autumnGreen, bg = "NONE" } }, { "packerSuccess", { fg = colors.autumnGreen, bg = "NONE" } },
{ "NeoTreeNormal", { bg = colors.sumiInk1 } }, { "NeoTreeNormal", { bg = colors.sumiInk1 } },
{ "NeoTreeNormalNC", { bg = colors.sumiInk1 } }, { "NeoTreeNormalNC", { bg = colors.sumiInk1 } },
{ "NoiceCmdlineIconCmdline", { fg = colors.oniViolet } }, { "NoiceCmdlineIconCmdline", { fg = colors.oniViolet } },
{ "NoiceCmdlinePopupBorderCmdline", { fg = colors.oniViolet } }, { "NoiceCmdlinePopupBorderCmdline", { fg = colors.oniViolet } },
{ "NoiceCmdlineIconFilter", { fg = colors.springGreen } }, { "NoiceCmdlineIconFilter", { fg = colors.springGreen } },
{ "NoiceCmdlinePopupBorderFilter", { fg = colors.springGreen } }, { "NoiceCmdlinePopupBorderFilter", { fg = colors.springGreen } },
{ "NoiceCmdLineIconLua", { fg = colors.crystalBlue } }, { "NoiceCmdLineIconLua", { fg = colors.crystalBlue } },
{ "NoiceCmdlinePopupBorderLua", { fg = colors.crystalBlue } }, { "NoiceCmdlinePopupBorderLua", { fg = colors.crystalBlue } },
{ "NoiceCmdlineIconHelp", { fg = colors.surimiOrange } }, { "NoiceCmdlineIconHelp", { fg = colors.surimiOrange } },
{ "NoiceCmdlinePopupBorderHelp", { fg = colors.surimiOrange } }, { "NoiceCmdlinePopupBorderHelp", { fg = colors.surimiOrange } },
{ "NoiceCmdLineIconSearch", { fg = colors.roninYellow } }, { "NoiceCmdLineIconSearch", { fg = colors.roninYellow } },
{ "NoiceCmdlinePopupBorderSearch", { fg = colors.roninYellow } }, { "NoiceCmdlinePopupBorderSearch", { fg = colors.roninYellow } },
{ "NoiceCmdlineIconIncRename", { fg = colors.peachRed } }, { "NoiceCmdlineIconIncRename", { fg = colors.peachRed } },
{ "NoiceCmdlinePopupdBorderIncRename", { fg = colors.peachRed } }, { "NoiceCmdlinePopupdBorderIncRename", { fg = colors.peachRed } },
{ "NoiceMini", { bg = colors.sumiInk4 } }, { "NoiceMini", { bg = colors.sumiInk4 } },
{ "NoiceLspProgressClient", { fg = colors.oniViolet, bold = true } }, { "NoiceLspProgressClient", { fg = colors.oniViolet, bold = true } },
{ "Folded", { underline = true, sp = colors.oniViolet, bg = "NONE" } }, { "Folded", { underline = true, sp = colors.oniViolet, bg = "NONE" } },
{ "UfoFoldedBg", { bg = colors.waveBlue1 } }, { "UfoFoldedBg", { bg = colors.waveBlue1 } },
{ "TSRainbowRed", { fg = colors.peachRed } }, { "TSRainbowRed", { fg = colors.peachRed } },
{ "TSRainbowYellow", { fg = colors.carpYellow } }, { "TSRainbowYellow", { fg = colors.carpYellow } },
{ "TSRainbowBlue", { fg = colors.crystalBlue } }, { "TSRainbowBlue", { fg = colors.crystalBlue } },
{ "TSRainbowGreen", { fg = colors.springGreen } }, { "TSRainbowGreen", { fg = colors.springGreen } },
{ "TSRainbowViolet", { fg = colors.oniViolet } }, { "TSRainbowViolet", { fg = colors.oniViolet } },
{ "TSRainbowCyan", { fg = colors.lightBlue } }, { "TSRainbowCyan", { fg = colors.lightBlue } },
{ "TreesitterContext", { bg = colors.sumiInk0 } }, { "TreesitterContext", { bg = colors.sumiInk0 } },
{ "FloatTitle", { bg = "NONE" } }, { "FloatTitle", { bg = "NONE" } },
{ "DiffviewFilePanelTitle", { fg = colors.crystalBlue } }, { "DiffviewFilePanelTitle", { fg = colors.crystalBlue } },
{ "LspInlayHint", { fg = colors.springViolet2, bg = colors.winterBlue } }, { "LspInlayHint", { fg = colors.springViolet2, bg = colors.winterBlue } },
{ "@text", { fg = colors.fujiWhite } }, { "@text", { fg = colors.fujiWhite } },
{ "RainbowDelimiterRed", { fg = colors.peachRed } }, { "RainbowDelimiterRed", { fg = colors.peachRed } },
{ "RainbowDelimiterYellow", { fg = colors.autumnYellow } }, { "RainbowDelimiterYellow", { fg = colors.autumnYellow } },
{ "RainbowDelimiterBlue", { fg = colors.crystalBlue } }, { "RainbowDelimiterBlue", { fg = colors.crystalBlue } },
{ "RainbowDelimiterOrange", { fg = colors.surimiOrange } }, { "RainbowDelimiterOrange", { fg = colors.surimiOrange } },
{ "RainbowDelimiterGreen", { fg = colors.waveAqua1 } }, { "RainbowDelimiterGreen", { fg = colors.waveAqua1 } },
{ "RainbowDelimiterViolet", { fg = colors.oniViolet } }, { "RainbowDelimiterViolet", { fg = colors.oniViolet } },
{ "RainbowDelimiterCyan", { fg = colors.lightBlue } }, { "RainbowDelimiterCyan", { fg = colors.lightBlue } },
{ "NotifyERRORBorder", { link = "NvimNotifyError" } }, { "NotifyERRORBorder", { link = "NvimNotifyError" } },
{ "NotifyERRORIcon", { link = "NvimNotifyError" } }, { "NotifyERRORIcon", { link = "NvimNotifyError" } },
{ "NotifyERRORTitle", { link = "NvimNotifyError" } }, { "NotifyERRORTitle", { link = "NvimNotifyError" } },
{ "NotifyWARNBorder", { link = "NvimNotifyWarn" } }, { "NotifyWARNBorder", { link = "NvimNotifyWarn" } },
{ "NotifyWARNIcon", { link = "NvimNotifyWarn" } }, { "NotifyWARNIcon", { link = "NvimNotifyWarn" } },
{ "NotifyWARNTitle", { link = "NvimNotifyWarn" } }, { "NotifyWARNTitle", { link = "NvimNotifyWarn" } },
{ "NotifyINFOBorder", { link = "NvimNotifyInfo" } }, { "NotifyINFOBorder", { link = "NvimNotifyInfo" } },
{ "NotifyINFOIcon", { link = "NvimNotifyInfo" } }, { "NotifyINFOIcon", { link = "NvimNotifyInfo" } },
{ "NotifyINFOTitle", { link = "NvimNotifyInfo" } }, { "NotifyINFOTitle", { link = "NvimNotifyInfo" } },
{ "NotifyDEBUGBorder", { link = "NvimNotifyDebug" } }, { "NotifyDEBUGBorder", { link = "NvimNotifyDebug" } },
{ "NotifyDEBUGIcon", { link = "NvimNotifyDebug" } }, { "NotifyDEBUGIcon", { link = "NvimNotifyDebug" } },
{ "NotifyDEBUGTitle", { link = "NvimNotifyDebug" } }, { "NotifyDEBUGTitle", { link = "NvimNotifyDebug" } },
{ "NotifyTRACEBorder", { link = "NvimNotifyTrace" } }, { "NotifyTRACEBorder", { link = "NvimNotifyTrace" } },
{ "NotifyTRACEIcon", { link = "NvimNotifyTrace" } }, { "NotifyTRACEIcon", { link = "NvimNotifyTrace" } },
{ "NotifyTRACETitle", { link = "NvimNotifyTrace" } }, { "NotifyTRACETitle", { link = "NvimNotifyTrace" } },
{ "NotificationInfo", { link = "NvimNotifyInfo" } }, { "NotificationInfo", { link = "NvimNotifyInfo" } },
{ "NotificationWarning", { link = "NvimNotifyWarn" } }, { "NotificationWarning", { link = "NvimNotifyWarn" } },
{ "NotificationError", { link = "NvimNotifyError" } }, { "NotificationError", { link = "NvimNotifyError" } },
-- Markup specific -- Markup specific
{ "@markup.raw", { fg = colors.carpYellow, bg = colors.sumiInk2 } }, { "@markup.raw", { fg = colors.carpYellow, bg = colors.sumiInk2 } },
{ "@markup.raw.block", select_hl("@markup.raw", { "fg" }) }, { "@markup.raw.block", select_hl("@markup.raw", { "fg" }) },
{ "@markup.raw.delimiter", { link = "@punctuation.delimiter" } }, { "@markup.raw.delimiter", { link = "@punctuation.delimiter" } },
{ "CodeBlock", function() return { bg = get_hl("@markup.raw")().bg } end }, {
{ "Headline", { bg = colors.sumiInk0 } }, "CodeBlock",
{ "@markup.list.checked", { fg = colors.springGreen } }, function()
{ "@markup.list.indeterminate", { fg = colors.carpYellow } }, return { bg = get_hl("@markup.raw")().bg }
{ "@markup.list.unchecked", { fg = colors.crystalBlue } }, end,
{ "@OrgTSCheckboxChecked.org", { link = "@markup.list.checked" } }, },
{ "@OrgTSCheckboxHalfChecked.org", { link = "@markup.list.indeterminate" } }, { "Headline", { bg = colors.sumiInk0 } },
{ "@OrgTSCheckbox.org", { link = "@markup.list.unchecked" } }, { "@markup.list.checked", { fg = colors.springGreen } },
{ "org_verbatim", { fg = colors.springGreen, bg = colors.sumiInk0 } }, { "@markup.list.indeterminate", { fg = colors.carpYellow } },
{ "org_code", { link = "@markup.raw" } }, { "@markup.list.unchecked", { fg = colors.crystalBlue } },
{ "@OrgTSBlock.org", { fg = colors.fujiGray, bold = true, italic = true } }, { "@markup.verbatim", { fg = colors.springGreen, bg = colors.sumiInk0 } },
{ "@OrgTSDirective.org", { link = "@OrgTSBlock.org" } }, { "@org.verbatim", { link = "@markup.verbatim" } },
{ "@org.verbatim.delimiter", { link = "@markup.verbatim" } },
{ "@org.timestamp", { underline = true, italic = false } },
{ "@org.timestamp.active", get_hl("@org.timestamp", { fg = colors.springViolet1 }) },
{
"@org.timestamp.active.delimiter",
{
fg = function()
return get_hl("@org.timestamp.active")().fg
end,
underline = false,
nocombine = true,
},
},
{
"@org.timestamp.inactive",
get_hl("@org.timestamp", {
fg = function()
return get_hl("@comment")().fg
end,
}),
},
{
"@org.timestamp.inactive.delimiter",
{
fg = function()
return get_hl("@org.timestamp.inactive")().fg
end,
underline = false,
nocombine = true,
},
},
-- Titles/Headlines -- Titles/Headlines
{ "@markup.heading.1", { fg = colors.crystalBlue, bold = true } }, { "@markup.heading.1", { fg = colors.crystalBlue, bold = true } },
{ "@markup.heading.2", { fg = colors.carpYellow, bold = true } }, { "@markup.heading.2", { fg = colors.carpYellow, bold = true } },
{ "@markup.heading.3", { fg = colors.peachRed, bold = true } }, { "@markup.heading.3", { fg = colors.peachRed, bold = true } },
{ "@markup.heading.4", { fg = colors.surimiOrange, bold = true } }, { "@markup.heading.4", { fg = colors.surimiOrange, bold = true } },
{ "@markup.heading.5", { fg = colors.oniViolet2, bold = true } }, { "@markup.heading.5", { fg = colors.oniViolet2, bold = true } },
{ "@markup.heading.6", { fg = colors.sakuraPink, bold = true } }, { "@markup.heading.6", { fg = colors.sakuraPink, bold = true } },
{ "@markup.heading.7", { fg = colors.lightBlue, bold = true } }, { "@markup.heading.7", { fg = colors.lightBlue, bold = true } },
{ "@markup.heading.8", { fg = colors.springGreen, bold = true } }, { "@markup.heading.8", { fg = colors.springGreen, bold = true } },
{ "@org.headline.level1", { link = "@markup.heading.1" } }, { "@org.headline.level1", { link = "@markup.heading.1" } },
{ "@org.headline.level2.org", { link = "@markup.heading.2" } }, { "@org.headline.level2.org", { link = "@markup.heading.2" } },
{ "@org.headline.level3.org", { link = "@markup.heading.3" } }, { "@org.headline.level3.org", { link = "@markup.heading.3" } },
{ "@org.headline.level4.org", { link = "@markup.heading.4" } }, { "@org.headline.level4.org", { link = "@markup.heading.4" } },
{ "@org.headline.level5.org", { link = "@markup.heading.5" } }, { "@org.headline.level5.org", { link = "@markup.heading.5" } },
{ "@org.headline.level6.org", { link = "@markup.heading.6" } }, { "@org.headline.level6.org", { link = "@markup.heading.6" } },
{ "@org.headline.level7.org", { link = "@markup.heading.7" } }, { "@org.headline.level7.org", { link = "@markup.heading.7" } },
{ "@org.headline.level8.org", { link = "@markup.heading.8" } }, { "@org.headline.level8.org", { link = "@markup.heading.8" } },
{ "@markup.heading.1.marker", { link = "@markup.heading.1" } }, { "@markup.heading.1.marker", { link = "@markup.heading.1" } },
{ "@markup.heading.2.marker", { link = "@markup.heading.2" } }, { "@markup.heading.2.marker", { link = "@markup.heading.2" } },
{ "@markup.heading.3.marker", { link = "@markup.heading.3" } }, { "@markup.heading.3.marker", { link = "@markup.heading.3" } },
{ "@markup.heading.4.marker", { link = "@markup.heading.4" } }, { "@markup.heading.4.marker", { link = "@markup.heading.4" } },
{ "@markup.heading.5.marker", { link = "@markup.heading.5" } }, { "@markup.heading.5.marker", { link = "@markup.heading.5" } },
{ "@markup.heading.6.marker", { link = "@markup.heading.6" } }, { "@markup.heading.6.marker", { link = "@markup.heading.6" } },
{ "@markup.heading.7.marker", { link = "@markup.heading.7" } }, { "@markup.heading.7.marker", { link = "@markup.heading.7" } },
{ "@markup.heading.8.marker", { link = "@markup.heading.8" } }, { "@markup.heading.8.marker", { link = "@markup.heading.8" } },
{ "@markup.quote", get_hl("@markup.quote", { italic = true }) }, { "@markup.quote", get_hl("@markup.quote", { italic = true }) },
{ "@markup.quote.org", get_hl("@markup.quote", { bg = colors.sumiInk5 }) }, { "@markup.quote.org", get_hl("@markup.quote", { bg = colors.sumiInk5 }) },
} }
vim.iter(extra_hls):enumerate():fold({}, function(t, index, tbl) vim.iter(extra_hls):enumerate():fold({}, function(t, index, tbl)
local hl_name = tbl[1] local hl_name = tbl[1]
local hl_opts = tbl[2] local hl_opts = tbl[2]
if t[hl_name] then local wrapper = function()
vim.notify(string.format("Duplicate highlight '%s' defined at index '%d'!", hl_name, index), if t[hl_name] then
vim.log.levels.ERROR) vim.notify(
end string.format("Duplicate highlight '%s' defined at index '%d'!", hl_name, index),
vim.log.levels.ERROR
)
end
if type(hl_opts) == "function" then if type(hl_opts) == "function" then
hl_opts = hl_opts() hl_opts = hl_opts()
end
hl_opts = vim.iter(hl_opts):fold({}, function(hl_t, k, v)
if type(v) == "function" then
v = v()
end
hl_t[k] = v
return hl_t
end)
if hl_opts.force == nil then
vim.tbl_deep_extend("force", hl_opts, { force = true })
end
vim.api.nvim_set_hl(0, hl_name, hl_opts)
t[hl_name] = true
return t
end end
if hl_opts.force == nil then local success, result = pcall(wrapper)
vim.tbl_deep_extend("force", hl_opts, { force = true })
end
local success, err = pcall(vim.api.nvim_set_hl, 0, hl_name, hl_opts)
if not success then if not success then
vim.notify( vim.notify(
string.format( string.format(
"Failed to set highlight for '%s', err: '%s' ... Table:\n%s", "Failed to set highlight for '%s', err: '%s' ... Table:\n%s",
hl_name, hl_name,
err, result,
vim.inspect(hl_opts) vim.inspect(hl_opts)
), ),
vim.log.levels.ERROR vim.log.levels.ERROR
) )
end end
t[hl_name] = true return result
return t
end) end)
end, end,
}, },

View File

@ -51,18 +51,6 @@ U.title_case = function(str)
return string.gsub(str, "(%a)([%w_']*)", inner) return string.gsub(str, "(%a)([%w_']*)", inner)
end end
---Get the effective given highlight, optionally overriding some of its fields
---@param name string Highlight name
---@param opts? vim.api.keyset.highlight
---@return fun(): vim.api.keyset.highlight
U.get_hl = function(name, opts)
---@return vim.api.keyset.highlight
return function()
---@diagnostic disable-next-line: return-type-mismatch
return vim.tbl_deep_extend("force", vim.api.nvim_get_hl(0, { name = name, link = false }), opts or {})
end
end
---@alias Highlight.Keys ---@alias Highlight.Keys
---| '"bold"' ---| '"bold"'
---| '"standout"' ---| '"standout"'
@ -95,6 +83,25 @@ end
---| '"force"' ---| '"force"'
---| '"url"' ---| '"url"'
---Get the effective given highlight, optionally overriding some of its fields
---@param name string Highlight name
---@param opts? vim.api.keyset.highlight | table<Highlight.Keys, fun(): string | integer>
---@return fun(): vim.api.keyset.highlight
U.get_hl = function(name, opts)
opts = vim.iter(opts or {}):fold({}, function(t, k, v)
if type(v) == "function" then
v = v()
end
t[k] = v
return t
end)
---@return vim.api.keyset.highlight
return function()
---@diagnostic disable-next-line: return-type-mismatch
return vim.tbl_deep_extend("force", vim.api.nvim_get_hl(0, { name = name, link = false }), opts or {})
end
end
---Get only the specified items from the highlight ---Get only the specified items from the highlight
---@param name string Highlight name ---@param name string Highlight name
---@param fields Highlight.Keys[] ---@param fields Highlight.Keys[]