From 64a4be5ffba6879fcb05ed34a3dae065e383b264 Mon Sep 17 00:00:00 2001 From: Daniel Hill <9439488+blazkowolf@users.noreply.github.com> Date: Sun, 2 Apr 2023 20:35:12 -0400 Subject: [PATCH] feat(treesitter): support most highlight groups --- lua/gruber-darker/highlight.lua | 1 + lua/gruber-darker/highlights/colorscheme.lua | 6 +- lua/gruber-darker/highlights/lsp.lua | 14 +- lua/gruber-darker/highlights/treesitter.lua | 251 ++++++++++++++----- lua/gruber-darker/highlights/vim.lua | 200 ++++++++------- 5 files changed, 315 insertions(+), 157 deletions(-) diff --git a/lua/gruber-darker/highlight.lua b/lua/gruber-darker/highlight.lua index d415af5..edd227e 100644 --- a/lua/gruber-darker/highlight.lua +++ b/lua/gruber-darker/highlight.lua @@ -59,6 +59,7 @@ end ---Set global highlight for the group this is associated with function Highlight:setup() + -- print(self.group) vim.api.nvim_set_hl(0, self.group, get_hl_definition_map(self.opts)) end diff --git a/lua/gruber-darker/highlights/colorscheme.lua b/lua/gruber-darker/highlights/colorscheme.lua index af0d43a..7777220 100644 --- a/lua/gruber-darker/highlights/colorscheme.lua +++ b/lua/gruber-darker/highlights/colorscheme.lua @@ -41,7 +41,7 @@ M.highlights.green = Highlight.new("GruberDarkerGreen", { fg = c.green }) M.highlights.green_bold = Highlight.new("GruberDarkerGreenBold", { fg = c.green, bold = opts.bold }) M.highlights.yellow = Highlight.new("GruberDarkerYellow", { fg = c.yellow }) -M.highlights.green_bold = Highlight.new("GruberDarkerYellowBold", { fg = c.yellow, bold = opts.bold }) +M.highlights.yellow_bold = Highlight.new("GruberDarkerYellowBold", { fg = c.yellow, bold = opts.bold }) M.highlights.brown = Highlight.new("GruberDarkerBrown", { fg = c.brown }) M.highlights.brown_bold = Highlight.new("GruberDarkerBrownBold", { fg = c.brown, bold = opts.bold }) @@ -64,6 +64,8 @@ M.highlights.wisteria_bold = Highlight.new("GruberDarkerWisteriaBold", { fg = c. -- Signs M.highlights.red_sign = Highlight.new("GruberDarkerRedSign", { fg = c.red, reverse = opts.invert.signs }) +M.highlights.yellow_sign = Highlight.new("GruberDarkerYellowSign", { fg = c.yellow, reverse = opts.invert.signs }) +M.highlights.green_sign = Highlight.new("GruberDarkerGreenSign", { fg = c.green, reverse = opts.invert.signs }) M.highlights.quartz_sign = Highlight.new("GruberDarkerQuartzSign", { fg = c.quartz, reverse = opts.invert.signs }) M.highlights.niagara_sign = @@ -74,6 +76,8 @@ M.highlights.wisteria_sign = -- Underlines M.highlights.red_underline = Highlight.new("GruberDarkerRedUnderline", { sp = c.red, undercurl = opts.undercurl }) +M.highlights.yellow_underline = Highlight.new("GruberDarkerYellowUnderline", { sp = c.yellow, undercurl = opts.undercurl }) +M.highlights.green_underline = Highlight.new("GruberDarkerGreenUnderline", { sp = c.green, undercurl = opts.undercurl }) M.highlights.quartz_underline = Highlight.new("GruberDarkerQuartzUnderline", { sp = c.quartz, undercurl = opts.undercurl }) M.highlights.niagara_underline = diff --git a/lua/gruber-darker/highlights/lsp.lua b/lua/gruber-darker/highlights/lsp.lua index 88e39c2..3db0aa0 100644 --- a/lua/gruber-darker/highlights/lsp.lua +++ b/lua/gruber-darker/highlights/lsp.lua @@ -14,17 +14,17 @@ function M.setup() end end -M.highlights.diagnostic_error = Highlight.new("DiagnosticError", { link = gruber_hl.red }) +M.highlights.diagnostic_error = Highlight.new("DiagnosticError", { link = gruber_hl.red_bold }) M.highlights.diagnostic_sign_error = Highlight.new("DiagnosticSignError", { link = gruber_hl.red_sign }) M.highlights.diagnostic_underline_error = Highlight.new("DiagnosticUnderlineError", { link = gruber_hl.red_underline }) --- M.highlights.diagnostic_warn = Highlight.new("DiagnosticWarn", { link = gruber_hl.red }) --- M.highlights.diagnostic_sign_warn = Highlight.new("DiagnosticSignWarn", { link = gruber_hl.red_sign }) --- M.highlights.diagnostic_underline_warn = Highlight.new("DiagnosticUnderlineWarn", { link = gruber_hl.red_underline }) +M.highlights.diagnostic_warn = Highlight.new("DiagnosticWarn", { link = gruber_hl.yellow_bold }) +M.highlights.diagnostic_sign_warn = Highlight.new("DiagnosticSignWarn", { link = gruber_hl.yellow_sign }) +M.highlights.diagnostic_underline_warn = Highlight.new("DiagnosticUnderlineWarn", { link = gruber_hl.yellow_underline }) -M.highlights.diagnostic_info = Highlight.new("DiagnosticInfo", { link = gruber_hl.niagara }) -M.highlights.diagnostic_sign_info = Highlight.new("DiagnosticSignInfo", { link = gruber_hl.niagara_sign }) -M.highlights.diagnostic_underline_info = Highlight.new("DiagnosticUnderlineInfo", { link = gruber_hl.niagara_underline }) +M.highlights.diagnostic_info = Highlight.new("DiagnosticInfo", { link = gruber_hl.green_bold }) +M.highlights.diagnostic_sign_info = Highlight.new("DiagnosticSignInfo", { link = gruber_hl.green_sign }) +M.highlights.diagnostic_underline_info = Highlight.new("DiagnosticUnderlineInfo", { link = gruber_hl.green_underline }) M.highlights.diagnostic_hint = Highlight.new("DiagnosticHint", { link = gruber_hl.wisteria }) M.highlights.diagnostic_sign_hint = Highlight.new("DiagnosticSignHint", { link = gruber_hl.wisteria_sign }) diff --git a/lua/gruber-darker/highlights/treesitter.lua b/lua/gruber-darker/highlights/treesitter.lua index 91cc240..88cb7f7 100644 --- a/lua/gruber-darker/highlights/treesitter.lua +++ b/lua/gruber-darker/highlights/treesitter.lua @@ -1,6 +1,7 @@ local c = require("gruber-darker.palette").default local opts = require("gruber-darker.config").get_opts() local vim_hl = require("gruber-darker.highlights.vim").highlights +local gruber_hl = require("gruber-darker.highlights.colorscheme").highlights local Highlight = require("gruber-darker.highlight") ---@type HighlightsProvider @@ -15,77 +16,201 @@ function M.setup() end end --- These groups are for the neovim tree-sitter highlights. --- As of writing, tree-sitter support is a WIP, group names may change. --- By, most of these groups link to an appropriate Vim group, --- TSError -> Error for example, so you do not have to define these unless --- you explicitly want to support Treesitter's improved syntax awareness. +-- Neovim tree-sitter highlights sourced from +-- https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#highlights --- TSAnnotation = Highlight.new("", { }) -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. --- TSAttribute = Highlight.new("", { }) -- (unstable) TODO: docs -M.highlights.boolean = Highlight.new("TSBoolean", { fg = c.quartz }) -- For booleans. -M.highlights.character = Highlight.new("TSCharacter", { link = vim_hl.character }) -- For characters. -M.highlights.comment = Highlight.new("TSComment", { link = vim_hl.comment }) -- For comment blocks. --- TSNote = Highlight.new("TSNote", { fg = c.bg, bg = c.info }) -M.highlights.text_warning = Highlight.new("@text.warning", { fg = c.red }) -M.highlights.text_danger = Highlight.new("@text.danger", { fg = c.white, bg = c.red }) --- ["@constructor"] = Highlight.new("", { fg = c.magenta }, -- For constructor calls and definitions: `= { })` in Lua, and Java constructors. -M.highlights.conditional = Highlight.new("TSConditional", { fg = c.yellow }) -- For keywords related to conditionnals. -M.highlights.constant = Highlight.new("TSConstant", { fg = c.quartz }) -- For constants --- TSConstBuiltin = Highlight.new("", { }) -- For constant that are built in the language: `nil` in Lua. --- TSConstMacro = Highlight.new("", { }) -- For constants that are defined by macros: `NULL` in C. --- TSError = Highlight.new("", { }) -- For syntax/parser errors. --- TSException = Highlight.new("", { }) -- For exception related keywords. --- ["@field"] = Highlight.new("", { fg = c.green1 }) -- For fields. --- TSFloat = Highlight.new("", { }) -- For floats. --- TSFunction = Highlight.new("", { }) -- For function (calls and definitions). --- TSFuncBuiltin = Highlight.new("", { }) -- For builtin functions: `table.insert` in Lua. --- TSFuncMacro = Highlight.new("", { }) -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust. --- TSInclude = Highlight.new("", { }) -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua. --- ["@keyword"] = Highlight.new("", { fg = c.purple, style = options.styles.keywords }) -- For keywords that don't fall in previous categories. --- ["@keyword.function"] = Highlight.new("", { fg = c.magenta, style = options.styles.functions }) -- For keywords used to define a fuction. --- ["@label"] = Highlight.new("", { fg = c.blue }) -- For labels: `label:` in C and `:label:` in Lua. --- TSMethod = Highlight.new("", { }) -- For method calls and definitions. --- TSNamespace = Highlight.new("", { }) -- For identifiers referring to modules and namespaces. --- TSNone = Highlight.new("", { }) -- TODO: docs --- TSNumber = Highlight.new("", { }) -- For all numbers --- ["@operator"] = Highlight.new("", { fg = c.blue5 }) -- For any operator: `+`, but also `->` and `*` in C. --- ["@parameter"] = Highlight.new("", { fg = c.yellow }) -- For parameters of a function. --- TSParameterReference= { }, -- For references to parameters of a function. --- ["@property"] = Highlight.new("", { fg = c.green1 }) -- Same as `TSField`. --- ["@punctuation.delimiter"] = Highlight.new("", { fg = c.blue5 }) -- For delimiters ie: `.` --- ["@punctuation.bracket"] = Highlight.new("", { fg = c.fg_dark }) -- For brackets and parens. --- ["@punctuation.special"] = Highlight.new("", { fg = c.blue5 }) -- For special punctutation that does not fall in the catagories before. +-- Misc --- For keywords related to loops. -M.highlights.repeats = Highlight.new("TSRepeat", { link = vim_hl.repeats }) --- For strings. -M.highlights.string = Highlight.new("TSString", { link = vim_hl.string }) --- ["@string.regex"] = Highlight.new("", { fg = c.blue6 }) -- For regexes. --- ["@string.escape"] = Highlight.new("", { fg = c.magenta }) -- For escape characters within a string. --- TSSymbol = Highlight.new("", { }) -- For identifiers referring to symbols or atoms. +---Line and block comments +M.highlights.comment = Highlight.new("@comment", { link = vim_hl.comment }) +---Comments documenting code +M.highlights.comment_documentation = Highlight.new("@comment.documentation", { link = gruber_hl.green }) +---Syntax/parser errors +M.highlights.error = Highlight.new("@error", {}) +---Completely disable the highlight +M.highlights.none = Highlight.new("@none", { fg = c.none, bg = c.none }) +---Various preprocessor directives & shebangs +M.highlights.pre_proc = Highlight.new("@preproc", { link = vim_hl.pre_proc }) +---Preprocessor definition directives +M.highlights.define = Highlight.new("@define", { link = vim_hl.define }) +---Symbolic operators (e.g. `+` / `*`) +M.highlights.operator = Highlight.new("@operator", { link = vim_hl.operator }) ----For types. -M.highlights.type = Highlight.new("TSType", { fg = c.quartz }) --- TSTypeBuiltin = Highlight.new("", { }) -- For builtin types. --- ["@variable"] = Highlight.new("", { style = options.styles.variables }) -- Any variable name that does not have another highlight. --- ["@variable.builtin"] = Highlight.new("", { fg = c.red }) -- Variable names that are defined by the languages, like `this` or `self`. +-- Punctuation --- TSTag = Highlight.new("", { }) -- Tags like html tag names. --- TSTagDelimiter = Highlight.new("", { }) -- Tag delimiter like `<` `>` `/` --- TSText = Highlight.new("", { }) -- For strings considered text in a markup language. --- ["@text.reference"] = Highlight.new("", { fg = c.teal }) --- TSEmphasis = Highlight.new("", { }) -- For text to be represented with emphasis. --- TSUnderline = Highlight.new("", { }) -- For text to be represented with an underline. --- TSStrike = Highlight.new("", { }) -- For strikethrough text. --- TSTitle = Highlight.new("", { }) -- Text that is part of a title. --- TSLiteral = Highlight.new("", { }) -- Literal text. +---Delimiters (e.g. `;` / `.` / `,`) +M.highlights.punctuation_delimiter = Highlight.new("@punctuation.delimiter", { link = vim_hl.delimiter }) +---Brackets (e.g. `()` / `{}` / `[]`) +M.highlights.punctuation_bracket = Highlight.new("@punctuation.bracket", { link = gruber_hl.wisteria }) +---Special symbols (e.g. `{}` in string interpolation) +M.highlights.punctuation_special = Highlight.new("punctuation.special", { link = gruber_hl.brown }) ----Any URI like a link or email. -M.highlights.uri = Highlight.new("TSURI", { fg = c.niagara, underline = opts.underline }) +-- Literals +---String literals +M.highlights.string = Highlight.new("@string", { link = vim_hl.string }) +---String documenting code (e.g. Python docstrings) +M.highlights.string_documentation = Highlight.new("@string.documentation", { link = vim_hl.string }) +---Regular expressions +M.highlights.string_regex = Highlight.new("@string.regex", { link = vim_hl.constant }) +---Escape sequences +M.highlights.string_escape = Highlight.new("@string.escape", { link = vim_hl.constant }) +---Other special strings (e.g dates) +M.highlights.string_special = Highlight.new("@string.special", { link = vim_hl.constant }) + +---Character literals +M.highlights.character = Highlight.new("@character", { link = vim_hl.character }) +---Special characters (e.g. wildcards) +M.highlights.character_special = Highlight.new("@character.special", { link = vim_hl.constant }) + +---Boolean literals +M.highlights.boolean = Highlight.new("@boolean", { link = vim_hl.boolean }) +---Numeric literals +M.highlights.number = Highlight.new("@number", { link = vim_hl.number }) +---Floating-point number literals +M.highlights.float = Highlight.new("@float", { link = vim_hl.float }) + +-- Functions + +---Function definitions +M.highlights.func = Highlight.new("@function", { link = vim_hl.func }) +---Built-in functions +M.highlights.func_builtin = Highlight.new("@function.builtin", { link = gruber_hl.yellow }) +---Function calls +-- M.highlights.func_call = Highlight.new("@function.call", {}) +---Preprocessor macros +M.highlights.func_macro = Highlight.new("@function.macro", { link = vim_hl.macro }) + +---Method definitions +M.highlights.method = Highlight.new("@method", { link = vim_hl.func }) +---Method calls +-- M.highlights.method_call = Highlight.new("@method.call", {}) + +---constructor calls and definitions +M.highlights.constructor = Highlight.new("@constructor", { link = vim_hl.func }) +---parameters of a function +M.highlights.parameter = Highlight.new("@parameter", { link = vim_hl.identifier }) + +-- Keywords + +---various keywords +M.highlights.keyword = Highlight.new("@keyword", { link = vim_hl.keyword }) +---keywords related to coroutines (e.g. `go` in Go, `async/await` in Python) +-- M.highlights.keyword_coroutine = Highlight.new("@keyword.coroutine", {}) +---keywords that define a function (e.g. `func` in Go, `def` in Python) +-- M.highlights.keyword_function = Highlight.new("@keyword.function", {}) +---operators that are English words (e.g. `and` / `or`) +-- M.highlights.keyword_operator = Highlight.new("@keyword.operator", {}) +---keywords like `return` and `yield` +-- M.highlights.keyword_return = Highlight.new("@keyword.return", {}) + +---keywords related to conditionals (e.g. `if` / `else`) +M.highlights.conditional = Highlight.new("@conditional", { fg = c.yellow }) +---ternary operator (e.g. `?` / `:`) +M.highlights.conditional_ternary = Highlight.new("@conditional.ternary", {}) + +---keywords related to loops (e.g. `for` / `while`) +M.highlights.repeats = Highlight.new("@repeat", { link = vim_hl.repeats }) +---keywords related to debugging +M.highlights.debug = Highlight.new("@debug", { link = vim_hl.debug }) +---GOTO and other labels (e.g. `label:` in C) +M.highlights.label = Highlight.new("@label", { link = vim_hl.label }) +---keywords for including modules (e.g. `import` / `from` in Python) +-- M.highlights.include = Highlight.new("@include", {}) +---keywords related to exceptions (e.g. `throw` / `catch`) +-- M.highlights.exception = Highlight.new("@exception", {}) + +-- Types + +---type or class definitions and annotations +M.highlights.type = Highlight.new("@type", { link = vim_hl.type }) +---built-in types +M.highlights.type_builtin = Highlight.new("@type.builtin", { link = gruber_hl.yellow }) +---type definitions (e.g. `typedef` in C) +M.highlights.type_definition = Highlight.new("@type.definition", { link = vim_hl.typedef }) +---type qualifiers (e.g. `const`) +-- M.highlights.type_qualifier = Highlight.new("@type.qualifier", {}) + +---modifiers that affect storage in memory or life-time +M.highlights.storage_class = Highlight.new("@storageclass", { link = vim_hl.storage_class }) +---attribute annotations (e.g. Python decorators) +-- I don't think this is supported anymore... +-- M.highlights.attribute = Highlight.new("@attribute", { link = gruber_hl.brown }) +---object and struct fields +M.highlights.field = Highlight.new("@field", { link = gruber_hl.niagara }) +---similar to `@field` +M.highlights.property = Highlight.new("@property", { link = gruber_hl.dark_niagara }) + +-- Identifiers + +---various variable names +M.highlights.variable = Highlight.new("@variable", { link = vim_hl.identifier }) +---built-in variable names (e.g. `this`) +M.highlights.variable_builtin = Highlight.new("@variable.builtin", { link = gruber_hl.yellow }) + +---constant identifiers +M.highlights.constant = Highlight.new("@constant", { link = vim_hl.constant }) +---built-in constant values +M.highlights.constant_builtin = Highlight.new("@constant.builtin", { link = gruber_hl.yellow }) +---constants defined by the preprocessor +M.highlights.constant_macro = Highlight.new("@constant.macro", { link = vim_hl.define }) + +---modules or namespaces +-- M.highlights.namespace = Highlight.new("@namespace", {}) +---symbols or atoms +-- M.highlights.symbol = Highlight.new("@symbol", {}) + +-- Text (mainly for markup languages) + +---non-structured text +M.highlights.text = Highlight.new("@text", { link = vim_hl.normal }) +---bold text +M.highlights.text_strong = Highlight.new("@text.strong", { link = vim_hl.bold }) +---text with emphasis +M.highlights.text_emphasis = Highlight.new("@text.emphasis", { link = vim_hl.italic }) +---underlined text +M.highlights.text_underline = Highlight.new("@text.underline", { link = vim_hl.underlined }) +---strikethrough text +M.highlights.text_strike = Highlight.new("@text.strike", { strikethrough = true }) +---text that is part of a title +M.highlights.text_title = Highlight.new("@text.title", { link = vim_hl.title }) +---literal or verbatim text (e.g., inline code) +M.highlights.text_literal = Highlight.new("@text.literal", { link = vim_hl.constant }) +---text quotations +-- M.highlights.text_quote = Highlight.new("@text.quote", {}) +---URIs (e.g. hyperlinks) +M.highlights.text_uri = Highlight.new("@text.uri", { fg = c.niagara, underline = opts.underline }) +---math environments (e.g. `$ ... $` in LaTeX) +-- M.highlights.text_math = Highlight.new("@text.math", { link = vim_hl.special }) +---text environments of markup languages +-- M.highlights.text_environment = Highlight.new("@text.environment", {}) +---text indicating the type of an environment +-- M.highlights.text_environment_name = Highlight.new("@text.environment.name", {}) +---text references, footnotes, citations, etc. +-- M.highlights.text_reference = Highlight.new("@text.reference", {}) + +---todo notes +M.highlights.text_todo = Highlight.new("@text.todo", { link = vim_hl.todo }) +---info notes +M.highlights.text_note = Highlight.new("@text.note", { link = vim_hl.comment }) +---warning notes +M.highlights.text_warning = Highlight.new("@text.warning", { link = vim_hl.warning_msg }) +---danger/error notes +M.highlights.text_danger = Highlight.new("@text.danger", { link = vim_hl.error_msg }) + +---added text (for diff files) M.highlights.text_diff_add = Highlight.new("@text.diff.add", { link = vim_hl.diff_add }) +---deleted text (for diff files) M.highlights.text_diff_delete = Highlight.new("@text.diff.delete", { link = vim_hl.diff_delete }) M.highlights.text_diff_change = Highlight.new("@text.diff.change", { link = vim_hl.diff_change }) +-- Tags (used for XML-like tags) + +---XML tag names +M.highlights.tag = Highlight.new("@tag", { link = vim_hl.tag }) +---XML tag attributes +M.highlights.tag_attribute = Highlight.new("@tag.attribute", { link = vim_hl.identifier }) +---XML tag delimiters +M.highlights.tag_delimiter = Highlight.new("@tag.delimiter", { link = vim_hl.delimiter }) + return M diff --git a/lua/gruber-darker/highlights/vim.lua b/lua/gruber-darker/highlights/vim.lua index 5d0e6c9..12e2d30 100644 --- a/lua/gruber-darker/highlights/vim.lua +++ b/lua/gruber-darker/highlights/vim.lua @@ -1,8 +1,8 @@ local Highlight = require("gruber-darker.highlight") local c = require("gruber-darker.palette").default local opts = require("gruber-darker.config").get_opts() +local gruber_hl = require("gruber-darker.highlights.colorscheme").highlights ----@type HighlightsProvider local M = { highlights = {}, } @@ -14,45 +14,46 @@ function M.setup() end end ----any comment +---Any comment M.highlights.comment = Highlight.new("Comment", { fg = c.brown, italic = opts.italic.comments }) ----used for the columns set with 'colorcolumn' +---Used for the columns set with 'colorcolumn' M.highlights.color_column = Highlight.new("ColorColumn", { bg = c["bg+2"] }) ----placeholder characters substituted for concealed text (see 'conceallevel') +---Placeholder characters substituted for concealed text (see 'conceallevel') M.highlights.conceal = Highlight.new("Conceal", { fg = c.fg, bg = c.bg }) ----character under the cursor +---Character under the cursor M.highlights.cursor = Highlight.new("Cursor", { bg = c.yellow }) ----the character under the cursor when |language-mapping| is used (see 'guicursor') +---The character under the cursor when |language-mapping| is used (see 'guicursor') M.highlights.l_cursor = Highlight.new("lCursor", { fg = c.none, bg = c.yellow }) ----like Cursor, but used when in IME mode |CursorIM| +---Like Cursor, but used when in IME mode |CursorIM| M.highlights.cursor_im = Highlight.new("CursorIM", { fg = c.none, bg = c.yellow }) ---Screen-column at the cursor, when 'cursorcolumn' is set. M.highlights.cursor_column = Highlight.new("CursorColumn", { bg = c["bg+2"] }) ---Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. M.highlights.cursor_line = Highlight.new("CursorLine", { bg = c["bg+1"] }) ----Directory = Highlight.new("Directory", { fg = c.lightblue }) ---directory names (and other special names in listings) +---Directory names (and other special names in listings) +M.highlights.directory = Highlight.new("Directory", { link = gruber_hl.niagara_bold }) ----diff mode: Added line |diff.txt| +---Diff mode: Added line |diff.txt| M.highlights.diff_add = Highlight.new("DiffAdd", { fg = c.green, bg = c.none }) ----diff mode: Changed line |diff.txt| +---Diff mode: Changed line |diff.txt| M.highlights.diff_change = Highlight.new("DiffChange", { fg = c.yellow, bg = c.none }) ----diff mode: Deleted line |diff.txt| +---Diff mode: Deleted line |diff.txt| M.highlights.diff_delete = Highlight.new("DiffDelete", { fg = c["red+1"], bg = c.none }) ----diff mode: Changed text within a changed line |diff.txt| +---Diff mode: Changed text within a changed line |diff.txt| M.highlights.diff_text = Highlight.new("DiffText", { fg = c.yellow, bg = c.none }) ----filler lines (~) after the end of the buffer. By, this is highlighted like |hl-NonText|. +---Filler lines (~) after the end of the buffer. By, this is highlighted like |hl-NonText|. M.highlights.end_of_buffer = Highlight.new("EndOfBuffer", { fg = c["bg+4"], bg = c.none }) ----cursor in a focused terminal +---Cursor in a focused terminal M.highlights.term_cursor = Highlight.new("TermCursor", { bg = c.yellow }) ---TermCursorNC= { }, ---cursor in an unfocused terminal ----error messages on the command line +---Error messages on the command line M.highlights.error_msg = Highlight.new("ErrorMsg", { fg = c.white, bg = c.red }) ----the column separating vertically split windows +---The column separating vertically split windows M.highlights.vert_split = Highlight.new("VertSplit", { fg = c["fg+2"], bg = c["bg+1"] }) ----the column separating vertically split windows +---The column separating vertically split windows M.highlights.win_separator = Highlight.new("WinSeparator", { fg = c["bg+2"], bold = opts.bold }) ----line used for closed folds +---Line used for closed folds M.highlights.folded = Highlight.new("Folded", { fg = c.brown, bg = c["fg+2"], italic = opts.italic.folds }) ---'foldcolumn' M.highlights.fold_column = Highlight.new("FoldColumn", { fg = c.brown, bg = c["fg+2"] }) @@ -67,22 +68,27 @@ M.highlights.cursor_line_number = Highlight.new("CursorLineNr", { fg = c.yellow ---The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| M.highlights.match_paren = Highlight.new("MatchParen", { fg = c.fg, bg = c.wisteria }) ---'showmode' message (e.g., "---INSERT ---") -M.highlights.mode_msg = Highlight.new("ModeMsg", { fg = c["fg+2"] }) ----MsgArea = Highlight.new("MsgArea", { fg = c.fg_dark }) ---Area for messages and cmdline ----MsgSeparator= { }, ---Separator for scrolled messages, `msgsep` flag of 'display' +M.highlights.mode_msg = Highlight.new("ModeMsg", { link = gruber_hl.fg2 }) +---Area for messages and cmdline +-- M.highlights.msg_area = Highlight.new("MsgArea", { fg = c.fg_dark }) +---Separator for scrolled messages, `msgsep` flag of 'display' +-- M.highlights.msg_separator = Highlight.new("MsgSeparator", { }), ---|more-prompt| M.highlights.more_msg = Highlight.new("MoreMsg", { fg = c["fg+2"] }) ---'@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. M.highlights.non_text = Highlight.new("NonText", { fg = c["fg+2"] }) ----normal text +---Normal text M.highlights.normal = Highlight.new("Normal", { fg = c.fg, bg = c.bg }) ----normal text in non-current windows +---Normal text in non-current windows M.highlights.normal_non_current = Highlight.new("NormalNC", { fg = c.fg, bg = c["bg-1"] }) ----normal text in sidebar +---Normal text in sidebar M.highlights.normal_sidebar = Highlight.new("NormalSB", { fg = c.fg, bg = c["bg-1"] }) ---Normal text in floating windows. M.highlights.normal_float = Highlight.new("NormalFloat", { fg = c.fg, bg = c.bg }) M.highlights.float_border = Highlight.new("FloatBorder", { fg = c["bg+2"], bg = c["bg-1"] }) + +-- Popup + ---Popup menu: normal item. M.highlights.popup_menu = Highlight.new("Pmenu", { fg = c.fg, bg = c["bg+1"] }) ---Popup menu: selected item. @@ -91,46 +97,61 @@ M.highlights.popup_menu_sel = Highlight.new("PmenuSel", { fg = c.fg, bg = c["bg+ M.highlights.popup_menu_sidebar = Highlight.new("PmenuSbar", { bg = c.bg }) ---Popup menu: Thumb of the scrollbar. M.highlights.popup_menu_thumb = Highlight.new("PmenuThumb", { bg = c.bg }) + ---|hit-enter| prompt and yes/no questions M.highlights.question = Highlight.new("Question", { fg = c.niagara }) ---Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. M.highlights.quick_fix_line = Highlight.new("QuickFixLine", { bg = c["bg+2"], bold = opts.bold }) + +-- Search + ---Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. M.highlights.search = Highlight.new("Search", { fg = c.black, bg = c.yellow }) ---'incsearch' highlighting; also used for the text replaced with ":s///c" M.highlights.incremental_search = Highlight.new("IncSearch", { fg = c.black, bg = c["fg+2"] }) M.highlights.current_search = Highlight.new("CurSearch", { link = M.highlights.incremental_search }) + ---Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| M.highlights.special_key = Highlight.new("SpecialKey", { fg = c["fg+2"] }) + +-- Spell + ---Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. -M.highlights.spell_bad = Highlight.new("SpellBad", { undercurl = true }) +M.highlights.spell_bad = Highlight.new("SpellBad", { link = gruber_hl.red_underline }) ---Word that should start with a capital. |spell| Combined with the highlighting used otherwise. -M.highlights.spell_cap = Highlight.new("SpellCap", { undercurl = true }) +M.highlights.spell_cap = Highlight.new("SpellCap", { undercurl = opts.undercurl }) ---Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. -M.highlights.spell_local = Highlight.new("SpellLocal", { undercurl = true }) +M.highlights.spell_local = Highlight.new("SpellLocal", { undercurl = opts.undercurl }) ---Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. -M.highlights.spell_rare = Highlight.new("SpellRare", { undercurl = true }) ----status line of current window +M.highlights.spell_rare = Highlight.new("SpellRare", { undercurl = opts.undercurl }) + +-- Statusline + +---Status line of current window M.highlights.status_line = Highlight.new("StatusLine", { fg = c.white, bg = c["bg+1"] }) ----status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. +---Status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. M.highlights.status_line_non_current = Highlight.new("StatusLineNC", { fg = c.quartz, bg = c["bg+1"] }) ----tab pages line, not active tab page label + +-- Tabline + +---Tab pages line, not active tab page label M.highlights.tab_line = Highlight.new("TabLine", { bg = c.none }) ----tab pages line, where there are no labels +---Tab pages line, where there are no labels M.highlights.tab_line_fill = Highlight.new("TabLineFill", { fg = c["bg+4"], bg = c["bg+1"] }) ----tab pages line, active tab page label +---Tab pages line, active tab page label M.highlights.tab_line_sel = Highlight.new("TabLineSel", { fg = c.yellow, bg = c.none, bold = opts.bold }) ----titles for output from ":set all", ":autocmd" etc. -M.highlights.title = Highlight.new("Title", { fg = c.quartz }) + +---Titles for output from ":set all", ":autocmd" etc. +M.highlights.title = Highlight.new("Title", { link = gruber_hl.quartz }) ---Visual mode selection M.highlights.visual = Highlight.new("Visual", { bg = c["bg+2"] }) ---Visual mode selection when vim is "Not Owning the Selection". -M.highlights.visual_nos = Highlight.new("VisualNOS", { fg = c.red }) ----warning messages -M.highlights.warning_msg = Highlight.new("WarningMsg", { fg = c.red }) +M.highlights.visual_nos = Highlight.new("VisualNOS", { link = gruber_hl.red }) +---Warning messages +M.highlights.warning_msg = Highlight.new("WarningMsg", { link = gruber_hl.red }) ---"nbsp", "space", "tab" and "trail" in 'listchars' M.highlights.whitespace = Highlight.new("Whitespace", { fg = c["bg+4"], bg = c.none }) ----current match in 'wildmenu' completion +---Current match in 'wildmenu' completion M.highlights.wild_menu = Highlight.new("WildMenu", { fg = c.black, bg = c.yellow }) ---These groups are not listed as vim groups, ---but they are defacto standard group names for syntax highlighting. @@ -139,64 +160,68 @@ M.highlights.wild_menu = Highlight.new("WildMenu", { fg = c.black, bg = c.yellow ---Uncomment and edit if you want more specific syntax highlighting. ---(preferred) any constant -M.highlights.constant = Highlight.new("Constant", { fg = c.quartz }) ---- a string constant: "this is a string" +M.highlights.constant = Highlight.new("Constant", { link = gruber_hl.quartz }) +---A string constant: "this is a string" M.highlights.string = Highlight.new("String", { fg = c.green, italic = opts.italic.strings }) ---- a character constant: 'c', '\n' +---A character constant: 'c', '\n' M.highlights.character = Highlight.new("Character", { fg = c.green, italic = opts.italic.strings }) ---- a number constant: 234, 0xff -M.highlights.number = Highlight.new("Number", { fg = c.fg }) ---- a boolean constant: TRUE, false -M.highlights.boolean = Highlight.new("Boolean", { fg = c.yellow, bold = opts.bold }) ---- a floating point constant: 2.3e10 -M.highlights.float = Highlight.new("Float", { fg = c.yellow, bold = opts.bold }) +---A number constant: 234, 0xff +M.highlights.number = Highlight.new("Number", { link = gruber_hl.wisteria }) +---A boolean constant: TRUE, false +M.highlights.boolean = Highlight.new("Boolean", { link = gruber_hl.yellow_bold }) +---A floating point constant: 2.3e10 +M.highlights.float = Highlight.new("Float", { link = gruber_hl.wisteria }) ---(preferred) any variable name -M.highlights.identifier = Highlight.new("Identifier", { fg = c["fg+1"] }) ----function name (also: methods for classes) -M.highlights.func = Highlight.new("Function", { fg = c.niagara }) +M.highlights.identifier = Highlight.new("Identifier", { link = gruber_hl.fg1 }) +---Function name (also: methods for classes) +M.highlights.func = Highlight.new("Function", { link = gruber_hl.niagara }) ---(preferred) any statement M.highlights.statement = Highlight.new("Statement", { fg = c.yellow }) ----if, then, else, endif, switch, etc. -M.highlights.conditional = Highlight.new("Conditional", { fg = c.yellow, bold = opts.bold }) ----for, do, while, etc. -M.highlights.repeats = Highlight.new("Repeat", { fg = c.yellow, bold = opts.bold }) ----case,, etc. -M.highlights.label = Highlight.new("Label", { fg = c.yellow, bold = opts.bold }) +---If, then, else, endif, switch, etc. +M.highlights.conditional = Highlight.new("Conditional", { link = gruber_hl.yellow_bold }) +---For, do, while, etc. +M.highlights.repeats = Highlight.new("Repeat", { link = gruber_hl.yellow_bold }) +---Case,, etc. +M.highlights.label = Highlight.new("Label", { link = gruber_hl.yellow_bold }) ---"sizeof", "+", "*", etc. -M.highlights.operator = Highlight.new("Operator", { fg = c.yellow, italic = opts.italic.operators }) ----any other keyword -M.highlights.keyword = Highlight.new("Keyword", { fg = c.yellow, bold = opts.bold }) ----try, catch, throw -M.highlights.exception = Highlight.new("Exception", { fg = c.yellow, bold = opts.bold }) +M.highlights.operator = Highlight.new("Operator", { fg = c.fg, italic = opts.italic.operators }) +---Any other keyword +M.highlights.keyword = Highlight.new("Keyword", { link = gruber_hl.yellow_bold }) +---Try, catch, throw +M.highlights.exception = Highlight.new("Exception", { link = gruber_hl.yellow_bold }) ---(preferred) generic Preprocessor -M.highlights.pre_proc = Highlight.new("PreProc", { fg = c.quartz }) ----preprocessor #include -M.highlights.include = Highlight.new("Include", { fg = c.quartz }) ----preprocessor #define -M.highlights.define = Highlight.new("Define", { fg = c.quartz }) ----same as Define -M.highlights.macro = Highlight.new("Macro", { fg = c.quartz }) ----preprocessor #if, #else, #endif, etc. -M.highlights.pre_condit = Highlight.new("PreCondit", { fg = c.quartz }) +M.highlights.pre_proc = Highlight.new("PreProc", { link = gruber_hl.quartz }) +---Preprocessor #include +M.highlights.include = Highlight.new("Include", { link = gruber_hl.quartz }) +---Preprocessor #define +M.highlights.define = Highlight.new("Define", { link = gruber_hl.quartz }) +---Same as Define +M.highlights.macro = Highlight.new("Macro", { link = gruber_hl.quartz }) +---Preprocessor #if, #else, #endif, etc. +M.highlights.pre_condit = Highlight.new("PreCondit", { link = gruber_hl.quartz }) ---(preferred) int, long, char, etc. -M.highlights.type = Highlight.new("Type", { fg = c.quartz }) ----static, register, volatile, etc. -M.highlights.storage_class = Highlight.new("StorageClass", { fg = c.yellow, bold = opts.bold }) ----struct, union, enum, etc. -M.highlights.structure = Highlight.new("Structure", { fg = c.yellow, bold = opts.bold }) +M.highlights.type = Highlight.new("Type", { link = gruber_hl.quartz }) +---Static, register, volatile, etc. +M.highlights.storage_class = Highlight.new("StorageClass", { link = gruber_hl.yellow_bold }) +---Struct, union, enum, etc. +M.highlights.structure = Highlight.new("Structure", { link = gruber_hl.yellow_bold }) ---A typedef -M.highlights.typedef = Highlight.new("Typedef", { fg = c.yellow, bold = opts.bold }) +M.highlights.typedef = Highlight.new("Typedef", { link = gruber_hl.yellow_bold }) ---(preferred) any special symbol -M.highlights.special = Highlight.new("Special", { fg = c.yellow }) ----SpecialChar = Highlight.new("", { }) --- special character in a constant ----Tag = Highlight.new("", { }) --- you can use CTRL-] on this ----Delimiter = Highlight.new("", { }) --- character that needs attention ----SpecialComment= { }, ---special things inside a comment ----Debug = Highlight.new("Debug", { fg = c["fg+2"] }) --- debugging statements +M.highlights.special = Highlight.new("Special", { link = gruber_hl.yellow }) +M.highlights.special_char = Highlight.new("SpecialChar", { link = gruber_hl.yellow }) --- special character in a constant +---You can use CTRL-] on this +M.highlights.tag = Highlight.new("Tag", { link = gruber_hl.yellow }) +---Character that needs attention +M.highlights.delimiter = Highlight.new("Delimiter", { link = gruber_hl.fg0 }) +---Special things inside a comment +M.highlights.special_comment = Highlight.new("SpecialComment", { link = gruber_hl.wisteria_bold }) +---Debugging statements +M.highlights.debug = Highlight.new("Debug", { link = gruber_hl.fg2 }) ---(preferred) text that stands out, HTML links -M.highlights.underlined = Highlight.new("Underlined", { underline = opts.underline }) -M.highlights.bold = Highlight.new("Bold", { bold = true }) +M.highlights.underlined = Highlight.new("Underlined", { fg = c.wisteria, underline = opts.underline }) +M.highlights.bold = Highlight.new("Bold", { bold = opts.bold }) M.highlights.italic = Highlight.new("Italic", { italic = true }) ---("Ignore", below, may be invisible...) ---Ignore = Highlight.new("Ignore", { }) ---(preferred) left blank, hidden |hl-Ignore| @@ -205,6 +230,9 @@ M.highlights.italic = Highlight.new("Italic", { italic = true }) ---(preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX M.highlights.todo = Highlight.new("Todo", { fg = c.bg, bg = c.yellow }) + +-- Markdown + M.highlights.md_heading_delim = Highlight.new("markdownHeadingDelimiter", { fg = c.niagara, bold = opts.bold }) M.highlights.md_code = Highlight.new("markdownCode", { fg = c.green }) M.highlights.md_code_block = Highlight.new("markdownCodeBlock", { fg = c.green }) @@ -212,7 +240,7 @@ M.highlights.md_code_block = Highlight.new("markdownCodeBlock", { fg = c.green } ---markdownH2 = Highlight.new("markdownH2", { fg = c.blue, bold = true }) ---markdownLinkText = Highlight.new("markdownLinkText", { fg = c.blue, underline = true }) M.highlights.md_italic = Highlight.new("markdownItalic", { fg = c.wisteria, italic = true }) -M.highlights.md_bold = Highlight.new("markdownBold", { fg = c.yellow, bold = opts.bold }) +M.highlights.md_bold = Highlight.new("markdownBold", { link = gruber_hl.yellow_bold }) M.highlights.md_code_delim = Highlight.new("markdownCodeDelimiter", { fg = c.brown, italic = true }) M.highlights.md_error = Highlight.new("markdownError", { fg = c.fg, bg = c["bg+1"] })