From eff13b522540610fc64c0d8bc4c21265cad66abb Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Thu, 25 Feb 2021 13:27:28 +0530 Subject: [PATCH] nvim: yolokai: Sync with upstream nvim-highlite --- nvim/.config/nvim/colors/yolokai.vim | 75 +++++++++++++++++------- nvim/.config/nvim/lua/yolokai.lua | 86 +++++++++++++--------------- 2 files changed, 94 insertions(+), 67 deletions(-) diff --git a/nvim/.config/nvim/colors/yolokai.vim b/nvim/.config/nvim/colors/yolokai.vim index bad0df7..d3917ee 100644 --- a/nvim/.config/nvim/colors/yolokai.vim +++ b/nvim/.config/nvim/colors/yolokai.vim @@ -109,8 +109,6 @@ local highlight_groups = { Ignore = {bg=NONE, fg=gray, style=NONE }, Error = {bg=black, fg=red, style=NONE }, Todo = {bg=NONE, fg=orange, style={'bold', 'underline'}}, - helpHyperTextJump = 'Underlined', - helpSpecial = 'Function' , Hint = {bg=lightblack3, fg=white, style='bold' }, Info = {bg=orange, fg=black, style='bold' }, Warning = {bg=pink, fg=black, style='bold' }, @@ -384,10 +382,21 @@ local highlight_groups = { rubyInterpolationDelimiter = 'Delimiter', --[[ 4.3.16. Rust ]] - rustKeyword = 'Keyword' , - rustModPath = 'Include' , - rustScopeDecl = 'Delimiter' , - rustTrait = 'StorageClass', + rustAssert = 'Debug' , + rustConstraint = 'Operator' , + rustDynKeyword = 'rustStorage', + rustGeneric = 'Delimiter' , + rustEscape = 'SpecialChar', + rustIdentifier = 'Identifier' , + rustKeyword = 'Keyword' , + rustLifetime = 'Label' , + rustModPath = 'Include' , + rustNoise = 'Delimiter' , + rustPanic = 'Exception' , + rustRepeat = 'Repeat' , + rustScopeDecl = 'Delimiter' , + rustStructure = 'Structure' , + rustUnused = 'Special' , --[[ 4.3.17. Scala ]] scalaKeyword = 'Keyword' , @@ -409,11 +418,12 @@ local highlight_groups = { --[[ 4.3.20. TOML ]] tomlComment = 'Comment' , + tomlDate = 'Special' , + tomlFloat = 'Float' , tomlKey = 'Label' , tomlTable = 'StorageClass', --[[ 4.3.21. VimScript ]] - helpSpecial = 'Special' , vimFgBgAttrib = 'Constant' , vimHiCterm = 'Label' , vimHiCtermFgBg = 'vimHiCterm', @@ -456,7 +466,7 @@ local highlight_groups = { luaFuncParens = 'Delimiter' , luaFuncTable = 'Structure' , luaLocal = 'Type' , - luaNoise = 'Operator' , + luaNoise = 'Delimiter' , luaParens = 'Delimiter' , luaSpecialTable = 'StorageClass', luaSpecialValue = 'Function' , @@ -479,7 +489,10 @@ local highlight_groups = { crontabMnth = 'Structure' , --[[ 4.3.28. PlantUML ]] - plantumlColonLine = {}, + plantumlArrowLR = 'Statement', + plantumlColonLine = NONE , + plantumlMindmap = 'Label' , + plantumlMindmap2 = 'Label' , --[[ 4.3.33. YAML ]] yamlKey = 'Label', @@ -487,18 +500,38 @@ local highlight_groups = { yamlPlainScalar = { bg=black, fg=green, style=NONE }, --[[ 4.3.34. Git ]] - gitrebaseBreak = 'Keyword' , - gitrebaseCommit = 'Tag' , - gitrebaseDrop = 'Exception' , - gitrebaseEdit = 'Define' , - gitrebaseExec = 'PreProc' , - gitrebaseFixup = 'gitrebaseSquash', - gitrebaseMerge = 'PreProc' , - gitrebasePick = 'Include' , - gitrebaseReset = 'gitrebaseLabel' , - gitrebaseReword = 'gitrebasePick' , - gitrebaseSquash = 'Macro' , - gitrebaseSummary = 'Normal' , + diffAdded = 'DiffAdd' , + diffRemoved = 'DiffDelete' , + gitcommitHeader = 'SpecialComment' , + gitcommitDiscardedFile = 'gitcommitSelectedFile', + gitcommitOverFlow = 'Error' , + gitcommitSelectedFile = 'Directory' , + gitcommitSummary = 'Title' , + gitcommitUntrackedFile = 'gitcommitSelectedFile', + gitconfigAssignment = 'String' , + gitconfigEscape = 'SpecialChar' , + gitconfigNone = 'Operator' , + gitconfigSection = 'Structure' , + gitconfigVariable = 'Label' , + gitrebaseBreak = 'Keyword' , + gitrebaseCommit = 'Tag' , + gitrebaseDrop = 'Exception' , + gitrebaseEdit = 'Define' , + gitrebaseExec = 'PreProc' , + gitrebaseFixup = 'gitrebaseSquash' , + gitrebaseMerge = 'PreProc' , + gitrebasePick = 'Include' , + gitrebaseReset = 'gitrebaseLabel' , + gitrebaseReword = 'gitrebasePick' , + gitrebaseSquash = 'Macro' , + gitrebaseSummary = 'Normal' , + + --[[ 4.3.35 Help ]] + helpHeader = 'Label' , + helpOption = 'Keyword' , + helpHeadline = 'Title' , + helpSectionDelim = 'Delimiter' , + helpHyperTextJump = 'Underlined', --[[ 4.4. Plugins Everything in this section is OPTIONAL. Feel free to remove everything diff --git a/nvim/.config/nvim/lua/yolokai.lua b/nvim/.config/nvim/lua/yolokai.lua index 0d228bc..bc694b1 100644 --- a/nvim/.config/nvim/lua/yolokai.lua +++ b/nvim/.config/nvim/lua/yolokai.lua @@ -153,55 +153,49 @@ function yolokai.highlight(highlight_group, attributes) -- {{{ † end --}}} ‡ function yolokai:highlight_terminal(terminal_ansi_colors) - for index, color in ipairs(terminal_ansi_colors) do - vim.g['terminal_color_'..index] = vim.o.termguicolors and color[_PALETTE_HEX] or color[_PALETTE_256] or get(color, _PALETTE_ANSI) + for index, color in ipairs(terminal_ansi_colors) do vim.g['terminal_color_'..(index-1)] = + vim.o.termguicolors and color[_PALETTE_HEX] or color[_PALETTE_256] or get(color, _PALETTE_ANSI) end end -return setmetatable(yolokai, { - ['__call'] = function(self, normal, highlights, terminal_ansi_colors) - -- function to resolve function highlight groups being defined by function calls. - local function resolve(tbl, key, resolve_links) - local value = tbl[key] - local value_type = type(value) - if value_type == 'function' then - -- lazily cache the result; next time, if it isn't a function this step will be skipped - tbl[key] = value(setmetatable({}, { - ['__index'] = function(_, inner_key) return resolve(tbl, inner_key, true) end - })) - elseif value_type == _TYPE_STRING and not string.find(value, '^#') and resolve_links then - return resolve(tbl, tbl[key], resolve_links) - end - - return tbl[key] +return setmetatable(yolokai, {['__call'] = function(self, normal, highlights, terminal_ansi_colors) + -- function to resolve function highlight groups being defined by function calls. + local function resolve(tbl, key, resolve_links) + local value = tbl[key] + local value_type = type(value) + if value_type == 'function' then + -- lazily cache the result; next time, if it isn't a function this step will be skipped + tbl[key] = value(setmetatable({}, { + ['__index'] = function(_, inner_key) return resolve(tbl, inner_key, true) end + })) + elseif value_type == _TYPE_STRING and not string.find(value, '^#') and resolve_links then + return resolve(tbl, tbl[key], resolve_links) end - - -- save the colors_name before syntax reset - local color_name = vim.g.colors_name - - -- Clear the highlighting. - exe 'hi clear' - - -- If the syntax has been enabled, reset it. - if fn.exists 'syntax_on' then exe 'syntax reset' end - - -- replace the colors_name - vim.g.colors_name = color_name - color_name = nil - - -- If we aren't using hex nor 256 colorsets. - if not (_USE_HEX or _USE_256) then vim.o.t_Co = '16' end - - -- Highlight the baseline. - self.highlight('Normal', normal) - - -- Highlight everything else. - for highlight_group, _ in pairs(highlights) do - self.highlight(highlight_group, resolve(highlights, highlight_group, false)) - end - - -- Set the terminal highlight colors. - self:highlight_terminal(terminal_ansi_colors) + return tbl[key] end -}) + + -- save the colors_name before syntax reset + local color_name = vim.g.colors_name + + -- If the syntax has been enabled, reset it. + if fn.exists 'syntax_on' then exe 'syntax reset' end + + -- replace the colors_name + vim.g.colors_name = color_name + color_name = nil + + -- If we aren't using hex nor 256 colorsets. + if not (_USE_HEX or _USE_256) then vim.o.t_Co = '16' end + + -- Highlight the baseline. + self.highlight('Normal', normal) + + -- Highlight everything else. + for highlight_group, _ in pairs(highlights) do + self.highlight(highlight_group, resolve(highlights, highlight_group, false)) + end + + -- Set the terminal highlight colors. + self:highlight_terminal(terminal_ansi_colors) +end})