rktjmp / lush.nvim

Create Neovim themes with real-time feedback, export anywhere.
MIT License
1.44k stars 47 forks source link

1.1.0 Release #88

Closed rktjmp closed 2 years ago

rktjmp commented 2 years ago

The 1.1.0 release of Lush brings the following changes:

The following features have been removed:

mcchrish commented 2 years ago

I'm getting an error:

E5113: Error while calling lua chunk: /Users/mcchris/Library/Preferences/nvim/plugin/colors.lua:22: Vim(lua):E5108: Error executing lua ...pport/nvim/site/pack/
packer/start/lush.nvim/lua/lush.lua:47: 'bg' is not a valid color
stack traceback:
        [C]: in function 'nvim_set_hl'
        ...pport/nvim/site/pack/packer/start/lush.nvim/lua/lush.lua:47: in function 'apply'
        ...pport/nvim/site/pack/packer/start/lush.nvim/lua/lush.lua:66: in function <...pport/nvim/site/pack/packer/start/lush.nvim/lua/lush.lua:64>
        ...te/pack/packer/start/zenbones.nvim/lua/zenbones/util.lua:8: in function 'apply_colorscheme'
        [string ":lua"]:1: in main chunk
rktjmp commented 2 years ago

I'm getting an error:

packer/start/lush.nvim/lua/lush.lua:47: 'bg' is not a valid color

https://github.com/mcchrish/zenbones.nvim/blob/e4def19944485787f5172bb952f8d46755999688/lua/zenbones/specs/dark.lua#L384 https://github.com/mcchrish/zenbones.nvim/blob/e4def19944485787f5172bb952f8d46755999688/lua/zenbones/specs/dark.lua#L365

NnnVertSplit                     { fg = "bg" },
NvimTreeVertSplit                { fg = "bg" },

Probably these never worked before but hi Xxx fg=bg was just not failing loudly?

mcchrish commented 2 years ago

I think it should be allowed.

:hi NnnVertSplit
NnnVertSplit   xxx guifg=bg

:hi Ignore
Ignore         xxx ctermfg=15 guifg=bg

Is it an upstream bug?

rktjmp commented 2 years ago

The error message comes from here:

https://github.com/neovim/neovim/blob/6d4180a0d20d0b730b6e64acdac39261f52a9277/src/nvim/highlight.c#L841-L848 -> https://github.com/neovim/neovim/blob/6d4180a0d20d0b730b6e64acdac39261f52a9277/src/nvim/highlight.c#L972 -> https://github.com/neovim/neovim/blob/6d4180a0d20d0b730b6e64acdac39261f52a9277/src/nvim/highlight_group.c#L2762-L2772

I think perhaps the groups are getting set before the Normal group which is why it probably appears "every other time". "bg" is valid, but sometimes normal_bg is not set yet and so it returns -1.

Probably I will have to pick out the Normal group from the highlights and force that to apply first. I think Normal is the only special case.

It is debatable whether it's a bug upstream in that they're assuming Normal always exists, which is probably fair to assume, and only appears if someone happens to use the special color values "bg"/"fg". Probably more of a documentation omission than a bug.

mcchrish commented 2 years ago

Thanks for the thorough explanation and digging!

I just test again and it's now fixed.

So far, I don't see noticeable perf improvement, at least according to --startuptime.

rktjmp commented 2 years ago

Merged but GH doesn't believe me. Release tagged as v2.0.0.

kevinhwang91 commented 2 years ago

I am only using a compiler. them.vim is actually faster than them.lua. vim.api.nvim_set_hl is slower than :highlight in the compiled file.

rktjmp commented 2 years ago

How are you benching that? I don't see the same behaviour:

```lua -- via-set-hl.lua local colors = { -- content here will not be touched -- PATCH_OPEN Normal = {fg = "#B4BDC3", bg = "#1C1917"}, Bold = {bold = true}, LightspeedUnlabeledMatch = {link = "Bold"}, TSStrong = {link = "Bold"}, BufferVisible = {fg = "#CAD0D4"}, BufferVisibleIndex = {fg = "#CAD0D4"}, BufferVisibleSign = {fg = "#CAD0D4"}, CmpItemAbbr = {fg = "#979FA4"}, CmpItemAbbrDeprecated = {fg = "#64696D"}, CmpItemAbbrMatch = {bold = true, fg = "#B4BDC3"}, CmpItemAbbrMatchFuzzy = {bold = true, fg = "#9FA7AD"}, CmpItemKind = {fg = "#868C91"}, CmpItemMenu = {fg = "#797F84"}, CocMarkdownLink = {underline = true, fg = "#66A5AD"}, ColorColumn = {bg = "#55392C"}, LspReferenceRead = {link = "ColorColumn"}, LspReferenceText = {link = "ColorColumn"}, LspReferenceWrite = {link = "ColorColumn"}, Comment = {italic = true, fg = "#6E6763"}, Conceal = {italic = true, bold = true, fg = "#797F84"}, LightspeedMaskedChar = {link = "Conceal"}, Constant = {italic = true, fg = "#868C91"}, TroubleSource = {link = "Constant"}, WhichKeyValue = {link = "Constant"}, helpHyperTextJump = {link = "Constant"}, helpOption = {link = "Constant"}, Cursor = {fg = "#1C1917", bg = "#C4CACF"}, TermCursor = {link = "Cursor"}, CursorLine = {bg = "#25211F"}, CursorColumn = {link = "CursorLine"}, NeogitDiffContextHighlight = {link = "CursorLine"}, TelescopeSelection = {link = "CursorLine"}, CursorLineNr = {bold = true, fg = "#B4BDC3", bg = "NONE"}, Delimiter = {fg = "#867A74"}, markdownLinkTextDelimiter = {link = "Delimiter"}, NeogitNotificationError = {link = "DiagnosticError"}, DiagnosticHint = {fg = "#B279A7"}, DiagnosticInfo = {fg = "#6099C0"}, NeogitNotificationInfo = {link = "DiagnosticInfo"}, TSNote = {link = "DiagnosticInfo"}, DiagnosticSignError = {fg = "#DE6E7C", bg = "NONE"}, CocErrorSign = {link = "DiagnosticSignError"}, DiagnosticSignHint = {fg = "#B279A7", bg = "NONE"}, CocHintSign = {link = "DiagnosticSignHint"}, DiagnosticSignInfo = {fg = "#6099C0", bg = "NONE"}, CocInfoSign = {link = "DiagnosticSignInfo"}, DiagnosticSignWarn = {fg = "#B77E64", bg = "NONE"}, CocWarningSign = {link = "DiagnosticSignWarn"}, DiagnosticUnderlineError = {undercurl = true, fg = "NONE", sp = "#DE6E7C"}, CocErrorHighlight = {link = "DiagnosticUnderlineError"}, DiagnosticUnderlineHint = {undercurl = true, fg = "NONE", sp = "#B279A7"}, CocHintHighlight = {link = "DiagnosticUnderlineHint"}, DiagnosticUnderlineInfo = {undercurl = true, fg = "NONE", sp = "#6099C0"}, CocInfoHighlight = {link = "DiagnosticUnderlineInfo"}, DiagnosticUnderlineWarn = {undercurl = true, fg = "NONE", sp = "#B77E64"}, CocWarningHighlight = {link = "DiagnosticUnderlineWarn"}, DiagnosticVirtualTextError = {fg = "#DE6E7C", bg = "#272020"}, CocErrorVirtualText = {link = "DiagnosticVirtualTextError"}, DiagnosticVirtualTextHint = {fg = "#B279A7", bg = "#252024"}, DiagnosticVirtualTextInfo = {fg = "#6099C0", bg = "#202223"}, DiagnosticVirtualTextWarn = {fg = "#B77E64", bg = "#242120"}, CocWarningVitualText = {link = "DiagnosticVirtualTextWarn"}, NeogitNotificationWarning = {link = "DiagnosticWarn"}, DiffAdd = {bg = "#232D1A"}, NeogitDiffAddHighlight = {link = "DiffAdd"}, DiffChange = {bg = "#1D2C36"}, DiffDelete = {bg = "#3E2225"}, NeogitDiffDeleteHighlight = {link = "DiffDelete"}, DiffText = {fg = "#B4BDC3", bg = "#324757"}, Directory = {bold = true}, Error = {fg = "#DE6E7C"}, DiagnosticError = {link = "Error"}, ErrorMsg = {link = "Error"}, TSDanger = {link = "Error"}, FloatBorder = {fg = "#837771", bg = "NONE"}, FoldColumn = {bold = true, fg = "#685F5A", bg = "NONE"}, Folded = {fg = "#AFA099", bg = "#393431"}, Function = {fg = "#B4BDC3"}, TroubleNormal = {link = "Function"}, TroubleText = {link = "Function"}, GitSignsAdd = {fg = "#819B69", bg = "NONE"}, GitGutterAdd = {link = "GitSignsAdd"}, GitSignsChange = {fg = "#6099C0", bg = "NONE"}, GitGutterChange = {link = "GitSignsChange"}, GitSignsDelete = {fg = "#DE6E7C", bg = "NONE"}, GitGutterDelete = {link = "GitSignsDelete"}, HopNextKey2 = {fg = "#6099C0"}, Identifier = {fg = "#979FA4"}, TSVariable = {link = "Identifier"}, IncSearch = {bold = true, fg = "#1C1917", bg = "#BF8FB5"}, CurSearch = {link = "IncSearch"}, IndentBlanklineChar = {fg = "#383432"}, Italic = {italic = true}, TSEmphasis = {link = "Italic"}, markdownTSEmphasis = {link = "Italic"}, LightspeedGreyWash = {fg = "#6E6763"}, HopUnmatched = {link = "LightspeedGreyWash"}, LightspeedLabel = {underline = true, bold = true, fg = "#B279A7"}, HopNextKey = {link = "LightspeedLabel"}, LightspeedLabelDistant = {underline = true, bold = true, fg = "#66A5AD"}, HopNextKey1 = {link = "LightspeedLabelDistant"}, LightspeedLabelDistantOverlapped = {underline = true, fg = "#66A5AD"}, LightspeedLabelOverlapped = {underline = true, fg = "#B279A7"}, LightspeedOneCharMatch = {bold = true, fg = "#1C1917", bg = "#B279A7"}, LightspeedPendingChangeOpArea = {fg = "#B279A7"}, LightspeedShortcut = {underline = true, bg = "#B279A7", bold = true, fg = "#1C1917"}, LineNr = {fg = "#685F5A", bg = "NONE"}, CocCodeLens = {link = "LineNr"}, LspCodeLens = {link = "LineNr"}, NeogitHunkHeader = {link = "LineNr"}, SignColumn = {link = "LineNr"}, WhichKeySeparator = {link = "LineNr"}, MoreMsg = {bold = true, fg = "#819B69"}, Question = {link = "MoreMsg"}, NeogitHunkHeaderHighlight = {bold = true, fg = "#B4BDC3", bg = "#25211F"}, NnnNormalNC = {link = "NnnNormal"}, NnnVertSplit = {fg = "bg"}, NonText = {fg = "#5C534F"}, EndOfBuffer = {link = "NonText"}, Whitespace = {link = "NonText"}, NormalFloat = {bg = "#302B29"}, Number = {italic = true, fg = "#B4BDC3"}, Boolean = {link = "Number"}, TSConstBuiltin = {link = "Number"}, TSConstMacro = {link = "Number"}, TSVariableBuiltin = {link = "Number"}, NvimTreeCursorLine = {bg = "#272321"}, NvimTreeCursorColumn = {link = "NvimTreeCursorLine"}, NvimTreeNormal = {fg = "#B4BDC3", bg = "#231F1D"}, NnnNormal = {link = "NvimTreeNormal"}, NvimTreeRootFolder = {bold = true, fg = "#6099C0"}, NvimTreeSpecialFile = {underline = true, fg = "#B279A7"}, NvimTreeSymlink = {fg = "#6099C0"}, NvimTreeVertSplit = {fg = "bg"}, Pmenu = {bg = "#302B29"}, PmenuSbar = {bg = "#615853"}, PmenuSel = {bg = "#4A433F"}, PmenuThumb = {bg = "#8E817B"}, Search = {fg = "#B4BDC3", bg = "#65435E"}, CocSearch = {link = "Search"}, MatchParen = {link = "Search"}, Sneak = {link = "Search"}, LightspeedPendingOpArea = {link = "SneakLabel"}, SneakLabelMask = {fg = "#B279A7", bg = "#B279A7"}, Special = {bold = true, fg = "#8D9499"}, TSNamespace = {link = "Special"}, TSTag = {link = "Special"}, WhichKeyGroup = {link = "Special"}, helpHyperTextEntry = {link = "Special"}, markdownTSPunctSpecial = {link = "Special"}, SpecialComment = {fg = "#6E6763"}, markdownTSURI = {link = "SpecialComment"}, SpecialKey = {italic = true, fg = "#5C534F"}, markdownTSStringEscape = {link = "SpecialKey"}, SpellBad = {undercurl = true, fg = "#CB7A83"}, CocSelectedText = {link = "SpellBad"}, SpellCap = {undercurl = true, fg = "#CB7A83"}, SpellLocal = {link = "SpellCap"}, SpellRare = {undercurl = true, fg = "#CB7A83"}, Statement = {bold = true, fg = "#B4BDC3"}, PreProc = {link = "Statement"}, WhichKey = {link = "Statement"}, markdownTSTitle = {link = "Statement"}, StatusLine = {fg = "#B4BDC3", bg = "#352F2D"}, TabLine = {link = "StatusLine"}, StatusLineNC = {fg = "#CAD0D4", bg = "#272321"}, TabLineFill = {link = "StatusLineNC"}, TSConstant = {bold = true, fg = "#979FA4"}, TabLineSel = {bold = true}, BufferCurrent = {link = "TabLineSel"}, TelescopeBorder = {fg = "#837771"}, TelescopeMatching = {bold = true, fg = "#B279A7"}, TelescopeSelectionCaret = {fg = "#DE6E7C", bg = "#25211F"}, Title = {bold = true, fg = "#B4BDC3"}, Todo = {underline = true, bold = true}, Type = {fg = "#A1938C"}, helpSpecial = {link = "Type"}, markdownTSLiteral = {link = "Type"}, Underlined = {underline = true}, TSUnderline = {link = "Underlined"}, VertSplit = {fg = "#685F5A", bg = "NONE"}, Visual = {bg = "#3D4042"}, WarningMsg = {fg = "#B77E64"}, DiagnosticWarn = {link = "WarningMsg"}, TSWarning = {link = "WarningMsg"}, gitcommitOverflow = {link = "WarningMsg"}, WildMenu = {fg = "#1C1917", bg = "#B279A7"}, SneakLabel = {link = "WildMenu"}, diffAdded = {fg = "#819B69"}, NvimTreeGitNew = {link = "diffAdded"}, diffChanged = {fg = "#6099C0"}, NvimTreeGitDirty = {link = "diffChanged"}, diffFile = {bold = true, fg = "#B77E64"}, diffIndexLine = {fg = "#B77E64"}, diffLine = {bold = true, fg = "#B279A7"}, diffNewFile = {italic = true, fg = "#819B69"}, diffOldFile = {italic = true, fg = "#DE6E7C"}, diffRemoved = {fg = "#DE6E7C"}, NvimTreeGitDeleted = {link = "diffRemoved"}, lCursor = {fg = "#1C1917", bg = "#797F84"}, TermCursorNC = {link = "lCursor"}, markdownCode = {link = "markdownTSLiteral"}, markdownTSTextReference = {underline = true, fg = "#979FA4"}, markdownLinkText = {link = "markdownTSTextReference"}, markdownUrl = {link = "markdownTSURI"}, -- PATCH_CLOSE -- content here will not be touched } -- colorschemes generally want to do this vim.cmd("highlight clear") vim.cmd("set t_Co=256") vim.cmd("let g:colors_name='my_theme'") vim.api.nvim_set_hl(0, "Normal", colors.Normal) -- apply highlight groups local a = vim.loop.hrtime() for group, attrs in pairs(colors) do vim.api.nvim_set_hl(0, group, attrs) end local b = vim.loop.hrtime() print(b-a) ``` ```lua -- via-highlight.lua vim.cmd("highlight clear") vim.cmd("set t_Co=256") vim.cmd("let g:colors_name='my_theme'") local a = vim.loop.hrtime() vim.cmd([[ " PATCH_OPEN highlight Normal guifg=#B4BDC3 guibg=#1C1917 guisp=NONE blend=NONE highlight Bold guifg=NONE guibg=NONE guisp=NONE blend=NONE gui=bold highlight! link LightspeedUnlabeledMatch Bold highlight! link TSStrong Bold highlight BufferVisible guifg=#CAD0D4 guibg=NONE guisp=NONE blend=NONE highlight BufferVisibleIndex guifg=#CAD0D4 guibg=NONE guisp=NONE blend=NONE highlight BufferVisibleSign guifg=#CAD0D4 guibg=NONE guisp=NONE blend=NONE highlight CmpItemAbbr guifg=#979FA4 guibg=NONE guisp=NONE blend=NONE highlight CmpItemAbbrDeprecated guifg=#64696D guibg=NONE guisp=NONE blend=NONE highlight CmpItemAbbrMatch guifg=#B4BDC3 guibg=NONE guisp=NONE blend=NONE gui=bold highlight CmpItemAbbrMatchFuzzy guifg=#9FA7AD guibg=NONE guisp=NONE blend=NONE gui=bold highlight CmpItemKind guifg=#868C91 guibg=NONE guisp=NONE blend=NONE highlight CmpItemMenu guifg=#797F84 guibg=NONE guisp=NONE blend=NONE highlight CocMarkdownLink guifg=#66A5AD guibg=NONE guisp=NONE blend=NONE gui=underline highlight ColorColumn guifg=NONE guibg=#55392C guisp=NONE blend=NONE highlight! link LspReferenceRead ColorColumn highlight! link LspReferenceText ColorColumn highlight! link LspReferenceWrite ColorColumn highlight Comment guifg=#6E6763 guibg=NONE guisp=NONE blend=NONE gui=italic highlight Conceal guifg=#797F84 guibg=NONE guisp=NONE blend=NONE gui=bold,italic highlight! link LightspeedMaskedChar Conceal highlight Constant guifg=#868C91 guibg=NONE guisp=NONE blend=NONE gui=italic highlight! link TroubleSource Constant highlight! link WhichKeyValue Constant highlight! link helpHyperTextJump Constant highlight! link helpOption Constant highlight Cursor guifg=#1C1917 guibg=#C4CACF guisp=NONE blend=NONE highlight! link TermCursor Cursor highlight CursorLine guifg=NONE guibg=#25211F guisp=NONE blend=NONE highlight! link CursorColumn CursorLine highlight! link NeogitDiffContextHighlight CursorLine highlight! link TelescopeSelection CursorLine highlight CursorLineNr guifg=#B4BDC3 guibg=NONE guisp=NONE blend=NONE gui=bold highlight Delimiter guifg=#867A74 guibg=NONE guisp=NONE blend=NONE highlight! link markdownLinkTextDelimiter Delimiter highlight! link NeogitNotificationError DiagnosticError highlight DiagnosticHint guifg=#B279A7 guibg=NONE guisp=NONE blend=NONE highlight DiagnosticInfo guifg=#6099C0 guibg=NONE guisp=NONE blend=NONE highlight! link NeogitNotificationInfo DiagnosticInfo highlight! link TSNote DiagnosticInfo highlight DiagnosticSignError guifg=#DE6E7C guibg=NONE guisp=NONE blend=NONE highlight! link CocErrorSign DiagnosticSignError highlight DiagnosticSignHint guifg=#B279A7 guibg=NONE guisp=NONE blend=NONE highlight! link CocHintSign DiagnosticSignHint highlight DiagnosticSignInfo guifg=#6099C0 guibg=NONE guisp=NONE blend=NONE highlight! link CocInfoSign DiagnosticSignInfo highlight DiagnosticSignWarn guifg=#B77E64 guibg=NONE guisp=NONE blend=NONE highlight! link CocWarningSign DiagnosticSignWarn highlight DiagnosticUnderlineError guifg=NONE guibg=NONE guisp=#DE6E7C blend=NONE gui=undercurl highlight! link CocErrorHighlight DiagnosticUnderlineError highlight DiagnosticUnderlineHint guifg=NONE guibg=NONE guisp=#B279A7 blend=NONE gui=undercurl highlight! link CocHintHighlight DiagnosticUnderlineHint highlight DiagnosticUnderlineInfo guifg=NONE guibg=NONE guisp=#6099C0 blend=NONE gui=undercurl highlight! link CocInfoHighlight DiagnosticUnderlineInfo highlight DiagnosticUnderlineWarn guifg=NONE guibg=NONE guisp=#B77E64 blend=NONE gui=undercurl highlight! link CocWarningHighlight DiagnosticUnderlineWarn highlight DiagnosticVirtualTextError guifg=#DE6E7C guibg=#272020 guisp=NONE blend=NONE highlight! link CocErrorVirtualText DiagnosticVirtualTextError highlight DiagnosticVirtualTextHint guifg=#B279A7 guibg=#252024 guisp=NONE blend=NONE highlight DiagnosticVirtualTextInfo guifg=#6099C0 guibg=#202223 guisp=NONE blend=NONE highlight DiagnosticVirtualTextWarn guifg=#B77E64 guibg=#242120 guisp=NONE blend=NONE highlight! link CocWarningVitualText DiagnosticVirtualTextWarn highlight! link NeogitNotificationWarning DiagnosticWarn highlight DiffAdd guifg=NONE guibg=#232D1A guisp=NONE blend=NONE highlight! link NeogitDiffAddHighlight DiffAdd highlight DiffChange guifg=NONE guibg=#1D2C36 guisp=NONE blend=NONE highlight DiffDelete guifg=NONE guibg=#3E2225 guisp=NONE blend=NONE highlight! link NeogitDiffDeleteHighlight DiffDelete highlight DiffText guifg=#B4BDC3 guibg=#324757 guisp=NONE blend=NONE highlight Directory guifg=NONE guibg=NONE guisp=NONE blend=NONE gui=bold highlight Error guifg=#DE6E7C guibg=NONE guisp=NONE blend=NONE highlight! link DiagnosticError Error highlight! link ErrorMsg Error highlight! link TSDanger Error highlight FloatBorder guifg=#837771 guibg=NONE guisp=NONE blend=NONE highlight FoldColumn guifg=#685F5A guibg=NONE guisp=NONE blend=NONE gui=bold highlight Folded guifg=#AFA099 guibg=#393431 guisp=NONE blend=NONE highlight Function guifg=#B4BDC3 guibg=NONE guisp=NONE blend=NONE highlight! link TroubleNormal Function highlight! link TroubleText Function highlight GitSignsAdd guifg=#819B69 guibg=NONE guisp=NONE blend=NONE highlight! link GitGutterAdd GitSignsAdd highlight GitSignsChange guifg=#6099C0 guibg=NONE guisp=NONE blend=NONE highlight! link GitGutterChange GitSignsChange highlight GitSignsDelete guifg=#DE6E7C guibg=NONE guisp=NONE blend=NONE highlight! link GitGutterDelete GitSignsDelete highlight HopNextKey2 guifg=#6099C0 guibg=NONE guisp=NONE blend=NONE highlight Identifier guifg=#979FA4 guibg=NONE guisp=NONE blend=NONE highlight! link TSVariable Identifier highlight IncSearch guifg=#1C1917 guibg=#BF8FB5 guisp=NONE blend=NONE gui=bold highlight! link CurSearch IncSearch highlight IndentBlanklineChar guifg=#383432 guibg=NONE guisp=NONE blend=NONE highlight Italic guifg=NONE guibg=NONE guisp=NONE blend=NONE gui=italic highlight! link TSEmphasis Italic highlight! link markdownTSEmphasis Italic highlight LightspeedGreyWash guifg=#6E6763 guibg=NONE guisp=NONE blend=NONE highlight! link HopUnmatched LightspeedGreyWash highlight LightspeedLabel guifg=#B279A7 guibg=NONE guisp=NONE blend=NONE gui=bold,underline highlight! link HopNextKey LightspeedLabel highlight LightspeedLabelDistant guifg=#66A5AD guibg=NONE guisp=NONE blend=NONE gui=bold,underline highlight! link HopNextKey1 LightspeedLabelDistant highlight LightspeedLabelDistantOverlapped guifg=#66A5AD guibg=NONE guisp=NONE blend=NONE gui=underline highlight LightspeedLabelOverlapped guifg=#B279A7 guibg=NONE guisp=NONE blend=NONE gui=underline highlight LightspeedOneCharMatch guifg=#1C1917 guibg=#B279A7 guisp=NONE blend=NONE gui=bold highlight LightspeedPendingChangeOpArea guifg=#B279A7 guibg=NONE guisp=NONE blend=NONE highlight LightspeedShortcut guifg=#1C1917 guibg=#B279A7 guisp=NONE blend=NONE gui=bold,underline highlight LineNr guifg=#685F5A guibg=NONE guisp=NONE blend=NONE highlight! link CocCodeLens LineNr highlight! link LspCodeLens LineNr highlight! link NeogitHunkHeader LineNr highlight! link SignColumn LineNr highlight! link WhichKeySeparator LineNr highlight MoreMsg guifg=#819B69 guibg=NONE guisp=NONE blend=NONE gui=bold highlight! link Question MoreMsg highlight NeogitHunkHeaderHighlight guifg=#B4BDC3 guibg=#25211F guisp=NONE blend=NONE gui=bold highlight! link NnnNormalNC NnnNormal highlight NnnVertSplit guifg=bg guibg=NONE guisp=NONE blend=NONE highlight NonText guifg=#5C534F guibg=NONE guisp=NONE blend=NONE highlight! link EndOfBuffer NonText highlight! link Whitespace NonText highlight NormalFloat guifg=NONE guibg=#302B29 guisp=NONE blend=NONE highlight Number guifg=#B4BDC3 guibg=NONE guisp=NONE blend=NONE gui=italic highlight! link Boolean Number highlight! link TSConstBuiltin Number highlight! link TSConstMacro Number highlight! link TSVariableBuiltin Number highlight NvimTreeCursorLine guifg=NONE guibg=#272321 guisp=NONE blend=NONE highlight! link NvimTreeCursorColumn NvimTreeCursorLine highlight NvimTreeNormal guifg=#B4BDC3 guibg=#231F1D guisp=NONE blend=NONE highlight! link NnnNormal NvimTreeNormal highlight NvimTreeRootFolder guifg=#6099C0 guibg=NONE guisp=NONE blend=NONE gui=bold highlight NvimTreeSpecialFile guifg=#B279A7 guibg=NONE guisp=NONE blend=NONE gui=underline highlight NvimTreeSymlink guifg=#6099C0 guibg=NONE guisp=NONE blend=NONE highlight NvimTreeVertSplit guifg=bg guibg=NONE guisp=NONE blend=NONE highlight Pmenu guifg=NONE guibg=#302B29 guisp=NONE blend=NONE highlight PmenuSbar guifg=NONE guibg=#615853 guisp=NONE blend=NONE highlight PmenuSel guifg=NONE guibg=#4A433F guisp=NONE blend=NONE highlight PmenuThumb guifg=NONE guibg=#8E817B guisp=NONE blend=NONE highlight Search guifg=#B4BDC3 guibg=#65435E guisp=NONE blend=NONE highlight! link CocSearch Search highlight! link MatchParen Search highlight! link Sneak Search highlight! link LightspeedPendingOpArea SneakLabel highlight SneakLabelMask guifg=#B279A7 guibg=#B279A7 guisp=NONE blend=NONE highlight Special guifg=#8D9499 guibg=NONE guisp=NONE blend=NONE gui=bold highlight! link TSNamespace Special highlight! link TSTag Special highlight! link WhichKeyGroup Special highlight! link helpHyperTextEntry Special highlight! link markdownTSPunctSpecial Special highlight SpecialComment guifg=#6E6763 guibg=NONE guisp=NONE blend=NONE highlight! link markdownTSURI SpecialComment highlight SpecialKey guifg=#5C534F guibg=NONE guisp=NONE blend=NONE gui=italic highlight! link markdownTSStringEscape SpecialKey highlight SpellBad guifg=#CB7A83 guibg=NONE guisp=NONE blend=NONE gui=undercurl highlight! link CocSelectedText SpellBad highlight SpellCap guifg=#CB7A83 guibg=NONE guisp=NONE blend=NONE gui=undercurl highlight! link SpellLocal SpellCap highlight SpellRare guifg=#CB7A83 guibg=NONE guisp=NONE blend=NONE gui=undercurl highlight Statement guifg=#B4BDC3 guibg=NONE guisp=NONE blend=NONE gui=bold highlight! link PreProc Statement highlight! link WhichKey Statement highlight! link markdownTSTitle Statement highlight StatusLine guifg=#B4BDC3 guibg=#352F2D guisp=NONE blend=NONE highlight! link TabLine StatusLine highlight StatusLineNC guifg=#CAD0D4 guibg=#272321 guisp=NONE blend=NONE highlight! link TabLineFill StatusLineNC highlight TSConstant guifg=#979FA4 guibg=NONE guisp=NONE blend=NONE gui=bold highlight TabLineSel guifg=NONE guibg=NONE guisp=NONE blend=NONE gui=bold highlight! link BufferCurrent TabLineSel highlight TelescopeBorder guifg=#837771 guibg=NONE guisp=NONE blend=NONE highlight TelescopeMatching guifg=#B279A7 guibg=NONE guisp=NONE blend=NONE gui=bold highlight TelescopeSelectionCaret guifg=#DE6E7C guibg=#25211F guisp=NONE blend=NONE highlight Title guifg=#B4BDC3 guibg=NONE guisp=NONE blend=NONE gui=bold highlight Todo guifg=NONE guibg=NONE guisp=NONE blend=NONE gui=bold,underline highlight Type guifg=#A1938C guibg=NONE guisp=NONE blend=NONE highlight! link helpSpecial Type highlight! link markdownTSLiteral Type highlight Underlined guifg=NONE guibg=NONE guisp=NONE blend=NONE gui=underline highlight! link TSUnderline Underlined highlight VertSplit guifg=#685F5A guibg=NONE guisp=NONE blend=NONE highlight Visual guifg=NONE guibg=#3D4042 guisp=NONE blend=NONE highlight WarningMsg guifg=#B77E64 guibg=NONE guisp=NONE blend=NONE highlight! link DiagnosticWarn WarningMsg highlight! link TSWarning WarningMsg highlight! link gitcommitOverflow WarningMsg highlight WildMenu guifg=#1C1917 guibg=#B279A7 guisp=NONE blend=NONE highlight! link SneakLabel WildMenu highlight diffAdded guifg=#819B69 guibg=NONE guisp=NONE blend=NONE highlight! link NvimTreeGitNew diffAdded highlight diffChanged guifg=#6099C0 guibg=NONE guisp=NONE blend=NONE highlight! link NvimTreeGitDirty diffChanged highlight diffFile guifg=#B77E64 guibg=NONE guisp=NONE blend=NONE gui=bold highlight diffIndexLine guifg=#B77E64 guibg=NONE guisp=NONE blend=NONE highlight diffLine guifg=#B279A7 guibg=NONE guisp=NONE blend=NONE gui=bold highlight diffNewFile guifg=#819B69 guibg=NONE guisp=NONE blend=NONE gui=italic highlight diffOldFile guifg=#DE6E7C guibg=NONE guisp=NONE blend=NONE gui=italic highlight diffRemoved guifg=#DE6E7C guibg=NONE guisp=NONE blend=NONE highlight! link NvimTreeGitDeleted diffRemoved highlight lCursor guifg=#1C1917 guibg=#797F84 guisp=NONE blend=NONE highlight! link TermCursorNC lCursor highlight! link markdownCode markdownTSLiteral highlight markdownTSTextReference guifg=#979FA4 guibg=NONE guisp=NONE blend=NONE gui=underline highlight! link markdownLinkText markdownTSTextReference highlight! link markdownUrl markdownTSURI " PATCH_CLOSE ]]) local b = vim.loop.hrtime() print(b-a) ```
:luafile via-highlight.lua
651773
:luafile via-highlight.lua
757173
:luafile via-highlight.lua
657299
:lua via-set-hl.lua
287265
:lua via-set-hl.lua
313764
:lua via-set-hl.lua
294182

Seems to be ~2x faster in the sections we can control and benchmark. Unsure on the numbers outside of our code but we can't effect those. (i.e. perhaps nvim collates the highlight commands and pushes them through faster than the calls to set_hl.)

kevinhwang91 commented 2 years ago

Sorry, you are right. I have accumulated the vim.v.vim_did_enter in Lua, which is so expensive.