diff --git a/doc/mellifluous.txt b/doc/mellifluous.txt index e3d7794..9a787e5 100644 --- a/doc/mellifluous.txt +++ b/doc/mellifluous.txt @@ -36,7 +36,7 @@ Example with packer.nvim : >lua use({ 'ramojus/mellifluous.nvim', - -- version = "v1.*", -- uncomment for stable config (some features might be missed if/when v2 comes out) + -- version = "v0.*", -- uncomment for stable config (some features might be missed if/when v1 comes out) config = function() require'mellifluous'.setup({}) -- optional, see configuration section. vim.cmd('colorscheme mellifluous') diff --git a/lua/mellifluous/highlights/general.lua b/lua/mellifluous/highlights/general.lua index 561341c..9cbd24d 100644 --- a/lua/mellifluous/highlights/general.lua +++ b/lua/mellifluous/highlights/general.lua @@ -14,57 +14,57 @@ function M.set(hl, colors) bg = (config.dim_inactive and colors.dark_bg) or (config.transparent_background and 'NONE') or hl.get('Normal').bg - }) -- normal text in non-current windows - hl.set('ColorColumn', { bg = colors.dark_bg }) -- Columns set with 'colorcolumn' - hl.set('Conceal', { fg = colors.fg5 }) -- Placeholder characters substituted for concealed text (see 'conceallevel') + }) -- normal text in non-current windows + hl.set('ColorColumn', { bg = colors.dark_bg }) -- Columns set with 'colorcolumn' + hl.set('Conceal', { fg = colors.fg5 }) -- Placeholder characters substituted for concealed text (see 'conceallevel') hl.set('Cursor', { bg = colors.other_keywords, fg = colors.bg }) -- Character under the cursor - hl.set('lCursor', { link = 'Cursor' }) -- Character under the cursor when |language-mapping| is used (see 'guicursor') - hl.set('CursorIM', { link = 'Cursor' }) -- Like Cursor, but used when in IME mode |CursorIM| - hl.set('CursorColumn', { bg = colors.bg2 }) -- Screen-column at the cursor, when 'cursorcolumn' is set. + hl.set('lCursor', { link = 'Cursor' }) -- Character under the cursor when |language-mapping| is used (see 'guicursor') + hl.set('CursorIM', { link = 'Cursor' }) -- Like Cursor, but used when in IME mode |CursorIM| + hl.set('CursorColumn', { bg = colors.bg2 }) -- Screen-column at the cursor, when 'cursorcolumn' is set. hl.set('CursorLine', { bg = (config.transparent_background.cursor_line and 'NONE') or colors.bg2 - }) -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. - hl.set('Directory', { fg = colors.functions }) -- Directory names (and other special names in listings) + }) -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. + hl.set('Directory', { fg = colors.functions }) -- Directory names (and other special names in listings) hl.set('DiffAdd', { bg = colors.bg:with_overlay(colors.ui_green, 15):saturated(20) }) -- Diff mode: Added line |diff.txt| hl.set('DiffDelete', { bg = colors.bg:with_overlay(colors.ui_red, 15):saturated(20) }) -- Diff mode: Deleted line |diff.txt| hl.set('DiffChange', { bg = colors.bg:with_overlay(colors.ui_orange, 15):saturated(20) }) -- Diff mode: Changed line |diff.txt| hl.set('DiffText', { bg = colors.bg:with_overlay(colors.ui_orange, 30):saturated(20) }) -- Diff mode: Changed text within a changed line |diff.txt| - hl.set('EndOfBuffer', { fg = colors.bg }) -- Filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. - hl.set('TermCursor', { link = 'Cursor' }) -- Cursor in a focused terminal - hl.set('TermCursorNC', { bg = colors.fg5 }) -- Cursor in an unfocused terminal - hl.set('ErrorMsg', { fg = colors.red }) -- Error messages on the command line + hl.set('EndOfBuffer', { fg = colors.bg }) -- Filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + hl.set('TermCursor', { link = 'Cursor' }) -- Cursor in a focused terminal + hl.set('TermCursorNC', { bg = colors.fg5 }) -- Cursor in an unfocused terminal + hl.set('ErrorMsg', { fg = colors.red }) -- Error messages on the command line hl.set('VertSplit', { fg = colors.fg5, bg = (config.dim_inactive and hl.get('NormalNC').bg) or (config.transparent_background.enabled and 'NONE') or hl.get('Normal').bg - }) -- Column separating vertically split windows + }) -- Column separating vertically split windows hl.set('Folded', { bg = colors.bg3, fg = colors.fg3, style = config.styles.folds or {} }) -- Line used for closed folds - hl.set('FoldColumn', { link = 'Normal' }) -- 'foldcolumn' + hl.set('FoldColumn', { link = 'Normal' }) -- 'foldcolumn' hl.set('LineNr', { fg = colors.fg4, bg = (config.transparent_background.enabled and 'NONE') or (config.flat_background.line_numbers and hl.get('Normal').bg) or colors.dark_bg - }) -- Line number for ':number' and ':#' commands, and when 'number' or 'relativenumber' option is set. - hl.set('SignColumn', { link = 'LineNr' }) -- Column where |signs| are displayed + }) -- Line number for ':number' and ':#' commands, and when 'number' or 'relativenumber' option is set. + hl.set('SignColumn', { link = 'LineNr' }) -- Column where |signs| are displayed hl.set('IncSearch', { bg = colors.other_keywords, fg = colors.bg }) -- 'incsearch' highlighting; also used for the text replaced with ':s///c' - hl.set('Substitute', { link = 'IncSearch' }) -- |:substitute| replacement text highlighting + hl.set('Substitute', { link = 'IncSearch' }) -- |:substitute| replacement text highlighting hl.set('CursorLineNr', { bg = (config.flat_background.cursor_line_number and hl.get('LineNr').bg) or (config.flat_background.line_numbers and hl.get('CursorLine').bg) or (config.transparent_background.enabled and 'NONE') or shader.get_shade(shade_recipes.dark_bg, hl.get('CursorLine').bg), fg = hl.get('LineNr').fg - }) -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + }) -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. hl.set('MatchParen', { bg = colors.bg4, fg = colors.main_keywords }) -- Character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| - hl.set('ModeMsg', { fg = colors.fg3 }) -- 'showmode' message (e.g., '-- INSERT -- ') - hl.set('MsgArea', { link = 'Normal' }) -- Area for messages and cmdline - hl.set('MsgSeparator', { link = 'VertSplit' }) -- Separator for scrolled messages, `msgsep` flag of 'display' - hl.set('MoreMsg', { fg = colors.other_keywords }) -- |more-prompt| - hl.set('NonText', { link = 'Conceal' }) -- '@' 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|. - hl.set('Title', { fg = colors.other_keywords }) -- Titles for output from ':set all', ':autocmd' etc. + hl.set('ModeMsg', { fg = colors.fg3 }) -- 'showmode' message (e.g., '-- INSERT -- ') + hl.set('MsgArea', { link = 'Normal' }) -- Area for messages and cmdline + hl.set('MsgSeparator', { link = 'VertSplit' }) -- Separator for scrolled messages, `msgsep` flag of 'display' + hl.set('MoreMsg', { fg = colors.other_keywords }) -- |more-prompt| + hl.set('NonText', { link = 'Conceal' }) -- '@' 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|. + hl.set('Title', { fg = colors.other_keywords }) -- Titles for output from ':set all', ':autocmd' etc. hl.set('NormalFloat', { bg = (config.transparent_background.floating_windows and 'NONE') or (config.flat_background.floating_windows and hl.get('Normal').bg) @@ -73,24 +73,24 @@ function M.set(hl, colors) hl.set('FloatBorder', { bg = hl.get('NormalFloat').bg, fg = ((config.transparent_background.floating_windows - or config.flat_background.floating_windows) - and colors.fg4) + or config.flat_background.floating_windows) + and colors.fg4) or hl.get('NormalFloat').bg }) hl.set('FloatTitle', { bg = hl.get('NormalFloat').bg, fg = colors.comments }) hl.set('FloatShadow', { bg = colors.dark_bg }) hl.set('Pmenu', { bg = colors.bg4, fg = config.is_bg_dark and colors.fg3 or colors.fg4 }) -- Popup menu: Normal item. - hl.set('PmenuSel', { bg = config.is_bg_dark and colors.fg5 or colors.dark_bg }) -- Popup menu: Selected item. - hl.set('PmenuSbar', { bg = colors.bg3 }) -- Popup menu: Scrollbar. - hl.set('PmenuThumb', { bg = colors.fg5 }) -- Popup menu: Thumb of the scrollbar. - hl.set('Question', { fg = colors.other_keywords }) -- |hit-enter| prompt and yes/no questions - hl.set('QuickFixLine', { link = 'Normal' }) -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. - hl.set('Search', { bg = colors.bg4, fg = colors.fg }) -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. - hl.set('SpecialKey', { fg = colors.other_keywords }) -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| - hl.set('SpellBad', { fg = colors.red }) -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. - hl.set('SpellCap', { fg = colors.orange }) -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. - hl.set('SpellLocal', { fg = colors.orange }) -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. - hl.set('SpellRare', { fg = colors.orange }) -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. + hl.set('PmenuSel', { bg = config.is_bg_dark and colors.fg5 or colors.dark_bg }) -- Popup menu: Selected item. + hl.set('PmenuSbar', { bg = colors.bg3 }) -- Popup menu: Scrollbar. + hl.set('PmenuThumb', { bg = colors.fg5 }) -- Popup menu: Thumb of the scrollbar. + hl.set('Question', { fg = colors.other_keywords }) -- |hit-enter| prompt and yes/no questions + hl.set('QuickFixLine', { link = 'Normal' }) -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. + hl.set('Search', { bg = colors.bg4, fg = colors.fg }) -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. + hl.set('SpecialKey', { fg = colors.other_keywords }) -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| + hl.set('SpellBad', { fg = colors.red }) -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. + hl.set('SpellCap', { fg = colors.orange }) -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. + hl.set('SpellLocal', { fg = colors.orange }) -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. + hl.set('SpellRare', { fg = colors.orange }) -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. hl.set('StatusLine', { bg = (config.transparent_background.status_line and 'NONE') or colors.bg4, @@ -100,16 +100,16 @@ function M.set(hl, colors) bg = (config.transparent_background.status_line and 'NONE') or colors.bg2, fg = colors.fg4 - }) -- Status lines of not-current windows. Note: If this is equal to 'StatusLine' Vim will use '^^^' in the status line of the current window. - hl.set('TabLine', { bg = hl.get('StatusLine').bg, fg = colors.fg3 }) -- Tab pages line, not active tab page label - hl.set('TabLineFill', { link = 'TabLine' }) -- Tab pages line, where there are no labels + }) -- Status lines of not-current windows. Note: If this is equal to 'StatusLine' Vim will use '^^^' in the status line of the current window. + hl.set('TabLine', { bg = hl.get('StatusLine').bg, fg = colors.fg3 }) -- Tab pages line, not active tab page label + hl.set('TabLineFill', { link = 'TabLine' }) -- Tab pages line, where there are no labels hl.set('TabLineSel', { bg = colors.bg2, fg = colors.fg2 }) -- Tab pages line, active tab page label hl.set('Visual', { bg = config.is_bg_dark and colors.bg4 or colors.dark_bg2 }) -- Visual mode selection - hl.set('VisualNOS', { bg = colors.bg3 }) -- Visual mode selection when vim is 'Not Owning the Selection'. - hl.set('WarningMsg', { fg = colors.red }) -- Warning messages - hl.set('Whitespace', { fg = colors.fg5 }) -- 'nbsp', 'space', 'tab' and 'trail' in 'listchars' - hl.set('WinSeparator', { link = 'VertSplit' }) -- Separator between window splits. Inherts from |hl-VertSplit| by default, which it will replace eventually. - hl.set('WildMenu', { link = 'PmenuSel' }) -- Current match in 'wildmenu' completion + hl.set('VisualNOS', { bg = colors.bg3 }) -- Visual mode selection when vim is 'Not Owning the Selection'. + hl.set('WarningMsg', { fg = colors.red }) -- Warning messages + hl.set('Whitespace', { fg = colors.fg5 }) -- 'nbsp', 'space', 'tab' and 'trail' in 'listchars' + hl.set('WinSeparator', { link = 'VertSplit' }) -- Separator between window splits. Inherts from |hl-VertSplit| by default, which it will replace eventually. + hl.set('WildMenu', { link = 'PmenuSel' }) -- Current match in 'wildmenu' completion -- Common vim syntax groups used for all kinds of code and markup. -- Commented-out groups should chain up to their preferred (*) group @@ -121,58 +121,59 @@ function M.set(hl, colors) hl.set('Comment', { fg = colors.comments, style = config.styles.comments or {} }) -- Any comment hl.set('Constant', { fg = colors.constants }) -- (*) Any constant hl.set('String', { fg = colors.strings, style = config.styles.strings or {} }) -- A string constant: 'this is a string' - hl.set('Character', { fg = hl.get('String').fg }) -- A character constant: 'c', '\n' - hl.set('Number', { link = 'Constant', style = config.styles.numbers or {} }) -- A number constant: 234, 0xff - hl.set('Boolean', { link = 'Constant', style = config.styles.booleans or {} }) -- A boolean constant: TRUE, false - hl.set('Float', { link = 'Constant', style = config.styles.numbers or {} }) -- A floating point constant: 2.3e10 + hl.set('Character', { fg = hl.get('String').fg }) -- A character constant: 'c', '\n' + hl.set('Number', { link = 'Constant', style = config.styles.numbers or {} }) -- A number constant: 234, 0xff + hl.set('Boolean', { link = 'Constant', style = config.styles.booleans or {} }) -- A boolean constant: TRUE, false + hl.set('Float', { link = 'Constant', style = config.styles.numbers or {} }) -- A floating point constant: 2.3e10 hl.set('Identifier', { fg = colors.fg, style = config.styles.variables or {} }) -- (*) Any variable name hl.set('Function', { fg = colors.functions, style = config.styles.functions or {} }) -- Function name (also: methods for classes) - hl.set('Statement', { fg = colors.other_keywords }) -- (*) Any statement + hl.set('Statement', { link = 'Keyword' }) -- (*) Any statement hl.set('Conditional', { fg = colors.main_keywords, style = config.styles.conditionals or {} }) -- if, then, else, endif, switch, etc. hl.set('Repeat', { fg = colors.main_keywords, style = config.styles.loops or {} }) -- for, do, while, etc. hl.set('Label', { fg = colors.other_keywords }) hl.set('Operator', { fg = config.is_bg_dark and colors.operators or colors.fg3, style = config.styles.operators or {} - }) -- 'sizeof', '+', '*', etc. - hl.set('Keyword', { fg = colors.other_keywords }) -- any other keyword - hl.set('Exception', { fg = colors.main_keywords }) -- try, catch, throw - hl.set('PreProc', { fg = colors.functions }) -- (*) Generic Preprocessor - hl.set('Include', { link = 'PreProc' }) -- Preprocessor #include - hl.set('Define', { link = 'PreProc' }) -- Preprocessor #define - hl.set('Macro', { link = 'PreProc' }) -- Same as Define - hl.set('PreCondit', { link = 'PreProc' }) -- Preprocessor #if, #else, #endif, etc. - hl.set('Type', { fg = colors.types, style = config.styles.types or {} }) -- (*) int, long, char, etc. - hl.set('StorageClass', { link = 'Type' }) -- static, register, volatile, etc. - hl.set('Structure', { link = 'Type' }) -- struct, union, enum, etc. - hl.set('Typedef', { link = 'Type' }) -- A typedef - hl.set('Special', { fg = colors.other_keywords }) -- (*) Any special symbol - hl.set('SpecialChar', { link = 'Special' }) -- Special character in a constant - hl.set('Tag', { link = 'Special' }) -- You can use CTRL-] on this - hl.set('Delimiter', { link = 'Operator' }) -- Character that needs attention - hl.set('SpecialComment', { link = 'Special' }) -- Special things inside a comment (e.g. '\n') - hl.set('Debug', { link = 'Special' }) -- Debugging statements - hl.set('Underlined', { underline = true, fg = colors.fg3 }) -- Text that stands out, HTML links + }) -- 'sizeof', '+', '*', etc. + hl.set('Keyword', { fg = colors.other_keywords, style = config.styles.keywords }) -- any other keyword + hl.set('MellifluousMainKeyword', { fg = colors.main_keywords, style = config.styles.keywords }) -- Mainly keywords related to control flow + hl.set('Exception', { link = 'MellifluousMainKeyword' }) -- try, catch, throw + hl.set('PreProc', { fg = colors.functions }) -- (*) Generic Preprocessor + hl.set('Include', { link = 'PreProc' }) -- Preprocessor #include + hl.set('Define', { link = 'PreProc' }) -- Preprocessor #define + hl.set('Macro', { link = 'PreProc' }) -- Same as Define + hl.set('PreCondit', { link = 'PreProc' }) -- Preprocessor #if, #else, #endif, etc. + hl.set('Type', { fg = colors.types, style = config.styles.types or {} }) -- (*) int, long, char, etc. + hl.set('StorageClass', { link = 'Type' }) -- static, register, volatile, etc. + hl.set('Structure', { link = 'Type' }) -- struct, union, enum, etc. + hl.set('Typedef', { link = 'Type' }) -- A typedef + hl.set('Special', { fg = colors.other_keywords }) -- (*) Any special symbol + hl.set('SpecialChar', { link = 'Special' }) -- Special character in a constant + hl.set('Tag', { link = 'Special' }) -- You can use CTRL-] on this + hl.set('Delimiter', { link = 'Operator' }) -- Character that needs attention + hl.set('SpecialComment', { link = 'Special' }) -- Special things inside a comment (e.g. '\n') + hl.set('Debug', { link = 'Special' }) -- Debugging statements + hl.set('Underlined', { underline = true, fg = colors.fg3 }) -- Text that stands out, HTML links hl.set('Bold', { bold = config.bold }) hl.set('Italic', { italic = config.italic }) - hl.set('Ignore', { fg = colors.fg5 }) -- Left blank, hidden |hl-Ignore| (NOTE: May be invisible here in template) - hl.set('Error', { fg = colors.red }) -- Any erroneous construct + hl.set('Ignore', { fg = colors.fg5 }) -- Left blank, hidden |hl-Ignore| (NOTE: May be invisible here in template) + hl.set('Error', { fg = colors.red }) -- Any erroneous construct hl.set('Todo', { bg = colors.bg:with_overlay(colors.ui_green, 20), fg = colors.ui_green }) -- Anything that needs extra attention; mostly the keywords TODO FIXME and XXX -- These groups are for the native LSP client and diagnostic system. Some -- other LSP clients may use these groups, or use their own. Consult your -- LSP client's documentation. hl.set('LspReferenceText', { bg = colors.bg3 }) -- Used for highlighting 'text' references - hl.set('LspReferenceRead', { link = 'LspReferenceText' }) -- Used for highlighting 'read' references - hl.set('LspReferenceWrite', { link = 'LspReferenceText' }) -- Used for highlighting 'write' references + hl.set('LspReferenceRead', { link = 'LspReferenceText' }) -- Used for highlighting 'read' references + hl.set('LspReferenceWrite', { link = 'LspReferenceText' }) -- Used for highlighting 'write' references hl.set('LspCodeLens', { bg = colors.bg2 }) -- Used to color the virtual text of the codelens. See |nvim_buf_set_extmark()|. hl.set('LspCodeLensSeparator', { fg = colors.fg5 }) -- Used to color the seperator between two or more code lens. hl.set('LspSignatureActiveParameter', { bg = colors.bg4 }) -- Used to highlight the active parameter in the signature help. See |vim.lsp.handlers.signature_help()|. --- - hl.set('DiagnosticError', { fg = colors.ui_red }) -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) - hl.set('DiagnosticWarn', { fg = colors.ui_orange }) -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) - hl.set('DiagnosticInfo', { fg = colors.ui_blue }) -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) - hl.set('DiagnosticHint', { fg = colors.ui_purple }) -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + hl.set('DiagnosticError', { fg = colors.ui_red }) -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + hl.set('DiagnosticWarn', { fg = colors.ui_orange }) -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + hl.set('DiagnosticInfo', { fg = colors.ui_blue }) -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + hl.set('DiagnosticHint', { fg = colors.ui_purple }) -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) hl.set('DiagnosticVirtualTextError', { fg = hl.get('DiagnosticError').fg, bg = (config.transparent_background.enabled and 'NONE') or diff --git a/lua/mellifluous/highlights/plugins/treesitter.lua b/lua/mellifluous/highlights/plugins/treesitter.lua index e4e25fd..431b5e1 100644 --- a/lua/mellifluous/highlights/plugins/treesitter.lua +++ b/lua/mellifluous/highlights/plugins/treesitter.lua @@ -4,75 +4,147 @@ function M.set(hl, colors) local shader = require('mellifluous.utils.shader') local config = require('mellifluous.config').config - hl.set('@attribute', { fg = colors.other_keywords }) -- Annotations that can be attached to the code to denote some kind of meta information. e.g. C++/Dart attributes. - hl.set('@boolean', { link = 'Boolean' }) -- Boolean literals: `True` and `False` in Python. - hl.set('@character', { link = 'Character' }) -- Character literals: `'a'` in C. - hl.set('@character.special', { link = 'Character' }) -- Special characters. - hl.set('@comment', { link = 'Comment' }) -- Line comments and block comments. - hl.set('@conditional', { link = 'Conditional' }) -- Keywords related to conditionals: `if`, `when`, `cond`, etc. - hl.set('@constant', { link = 'Constant' }) -- Constants identifiers. These might not be semantically constant. E.g. uppercase variables in Python. - hl.set('@constant.builtin', { link = 'Constant' }) -- Built-in constant values: `nil` in Lua. - hl.set('@constant.macro', { link = 'Constant' }) -- Constants defined by macros: `NULL` in C. - hl.set('@constructor', { link = 'Function' }) -- Constructor calls and definitions: `{}` in Lua, and Java constructors. - hl.set('@debug', { fg = colors.other_keywords }) -- Debugging statements. - hl.set('@define', { link = 'PreProc' }) -- Preprocessor #define statements. - hl.set('@error', { link = 'Error' }) -- Syntax/parser errors. This might highlight large sections of code while the user is typing still incomplete code, use a sensible highlight. - hl.set('@exception', { link = 'Exception', style = config.styles.keywords }) -- Exception related keywords: `try`, `except`, `finally` in Python. - hl.set('@field', { fg = colors.fg, style = config.styles.properties }) -- Object and struct fields. - hl.set('@float', { link = 'Float' }) -- Floating-point number literals. - hl.set('@function', { link = 'Function' }) -- Function calls and definitions. - hl.set('@function.builtin', { link = 'Function' }) -- Built-in functions: `print` in Lua. - hl.set('@function.macro', { link = 'Function' }) -- Macro defined functions (calls and definitions): each `macro_rules` in Rust. - hl.set('@include', { link = 'Function', style = {} }) -- File or module inclusion keywords: `#include` in C, `use` or `extern crate` in Rust. - hl.set('@keyword', { link = 'Keyword' }) -- Keywords that don't fit into other categories. - hl.set('@keyword.function', { fg = colors.main_keywords, style = config.styles.keywords }) -- Keywords used to define a function: `function` in Lua, `def` and `lambda` in Python. - hl.set('@keyword.operator', { fg = colors.other_keywords, style = config.styles.operators }) -- Unary and binary operators that are English words: `and`, `or` in Python; `sizeof` in C. - hl.set('@keyword.return', { fg = colors.main_keywords, style = config.styles.keywords }) -- Keywords like `return` and `yield`. - hl.set('@label', { link = 'Label' }) -- GOTO labels: `label:` in C, and `::label::` in Lua. - hl.set('@label.markdown', { fg = colors.comments }) -- Code block language - hl.set('@method', { link = 'Function' }) -- Method calls and definitions. - hl.set('@namespace', { link = 'Type', style = {} }) -- Identifiers referring to modules and namespaces. - hl.set('@number', { link = 'Number' }) -- Numeric literals that don't fit into other categories. - hl.set('@operator', { link = 'Operator' }) -- Binary or unary operators: `+`, and also `->` and `*` in C. - hl.set('@parameter', { fg = colors.fg }) -- Parameters of a function. - hl.set('@parameter.reference', { link = '@parameter' }) -- References to parameters of a function. - hl.set('@preProc', { link = 'PreProc' }) -- Preprocessor #if, #else, #endif, etc. - hl.set('@property', { link = '@field' }) -- Same as `TSField`. - hl.set('@punctuation.delimiter', { link = 'Operator', style = {} }) -- Punctuation delimiters: Periods, commas, semicolons, etc. - hl.set('@punctuation.bracket', { link = 'Operator', style = {} }) -- Brackets, braces, parentheses, etc. - hl.set('@punctuation.special', { link = 'Operator', style = {} }) -- Special punctuation that doesn't fit into the previous categories. - hl.set('@repeat', { link = 'Repeat' }) -- Keywords related to loops: `for`, `while`, etc. - hl.set('@storage.class', { link = 'StorageClass' }) -- Keywords that affect how a variable is stored: `static`, `comptime`, `extern`, etc. - hl.set('@string', { link = 'String' }) -- String literals. - hl.set('@string.regex', { link = 'Character', style = config.styles.strings }) -- Regular expression literals. - hl.set('@string.escape', { link = 'Character', style = config.styles.strings }) -- Escape characters within a string: `\n`, `\t`, etc. - hl.set('@string.special', { link = 'Character', style = config.styles.strings }) -- Strings with special meaning that don't fit into the previous categories. - hl.set('@symbol', { link = 'Character' }) -- Identifiers referring to symbols or atoms. - hl.set('@tag', { link = 'Keyword' }) -- Tags like HTML tag names. - hl.set('@tag.attribute', { link = 'Function', style = {} }) -- HTML tag attributes. - hl.set('@tag.delimiter', { link = 'Operator', style = {} }) -- Tag delimiters like `<` `>` `/`. - hl.set('@text', { bg = 'NONE' }) -- Non-structured text. Like text in a markup language. - hl.set('@text.strong', { style = { bold = true } }) -- Text to be represented in bold. - hl.set('@text.emphasis', { style = { italic = true } }) -- Text to be represented with emphasis. - hl.set('@text.underline', { style = { underline = true } }) -- Text to be represented with an underline. - hl.set('@text.strike', { style = { strikethrough = true } }) -- Strikethrough text. - hl.set('@text.title', { fg = colors.other_keywords }) -- Text that is part of a title. - hl.set('@text.literal', { link = 'Character' }) -- Literal or verbatim text. - hl.set('@text.uri', { fg = shader.get_lower_contrast(colors.blue, 15), style = { underline = true } }) -- URIs like hyperlinks or email addresses. - hl.set('@text.todo', { link = 'Todo' }) - hl.set('@text.danger', { bg = colors.bg:with_overlay(colors.ui_orange, 20), fg = colors.ui_orange }) - hl.set('@text.warning', { bg = colors.bg:with_overlay(colors.ui_red, 20), fg = colors.ui_red }) - hl.set('@math', { fg = colors.other_keywords }) -- Math environments like LaTeX's `$ ... $` - hl.set('@text.reference', { fg = colors.constants }) -- Footnotes, text references, citations, etc. - hl.set('@environment', { fg = colors.other_keywords }) -- Text environments of markup languages. - hl.set('@environment.name', { link = '@environment' }) -- Text/string indicating the type of text environment. Like the name of a `\begin` block in LaTeX. - hl.set('@note', { fg = colors.special_comments }) -- Text representation of an informational note. - hl.set('@warning', { fg = colors.orange }) -- Text representation of a warning note. - hl.set('@danger', { fg = colors.red }) -- Text representation of a danger note. - hl.set('@type', { link = 'Type' }) -- Type (and class) definitions and annotations. - hl.set('@type.builtin', { link = 'Type' }) -- Built-in types: `i32` in Rust. - hl.set('@variable', { link = 'Identifier' }) -- Variable names that don't fit into other categories. - hl.set('@variable.builtin', { fg = colors.other_keywords }) -- Variable names defined by the language: `this` or `self` in Javascript. + -- Identifiers + hl.set('@variable', { link = 'Identifier' }) -- Variable names that don't fit into other categories. + hl.set('@variable.builtin', { fg = colors.other_keywords }) -- Variable names defined by the language: `this` or `self` in Javascript. + hl.set('@variable.parameter', { fg = colors.fg }) -- Parameters of a function. + hl.set('@variable.parameter.reference', { link = '@variable.parameter' }) -- References to parameters of a function. + hl.set('@variable.member', { fg = colors.fg, style = config.styles.properties }) -- Object and struct fields. + hl.set('@constant', { link = 'Constant' }) -- Constants identifiers. These might not be semantically constant. E.g. uppercase variables in Python. + hl.set('@constant.builtin', { link = 'Constant' }) -- Built-in constant values: `nil` in Lua. + hl.set('@constant.macro', { link = 'Constant' }) -- Constants defined by macros: `NULL` in C. + hl.set('@module', { link = 'Type', style = {} }) -- Identifiers referring to modules and namespaces. + hl.set('@label', { link = 'Label' }) -- GOTO labels: `label:` in C, and `::label::` in Lua. + hl.set('@label.markdown', { fg = colors.comments }) -- Code block language + + -- Literals + hl.set('@string', { link = 'String' }) -- String literals. + hl.set('@string.documentation', { fg = colors.green }) -- String documenting code (e.g. Python docstrings) + hl.set('@string.regexp', { link = 'Character', style = config.styles.strings }) -- Regular expression literals. + hl.set('@string.escape', { link = 'Character', style = config.styles.strings }) -- Escape characters within a string: `\n`, `\t`, etc. + hl.set('@string.special', { link = 'Character', style = config.styles.strings }) -- Strings with special meaning that don't fit into the previous categories. + hl.set('@string.special.symbol', { link = 'Character' }) -- Identifiers referring to symbols or atoms. + hl.set('@string.special.url', { + fg = shader.get_lower_contrast(colors.blue, 15), + style = { underline = true } + }) -- URIs (e.g. hyperlinks) + hl.set('@string.special.path', { link = '@string.special.url' }) -- Filenames + hl.set('@character', { link = 'Character' }) -- Character literals: `'a'` in C. + hl.set('@character.special', { link = 'Character' }) -- Special characters. + hl.set('@boolean', { link = 'Boolean' }) -- Boolean literals: `True` and `False` in Python. + hl.set('@number', { link = 'Number' }) -- Numeric literals that don't fit into other categories. + hl.set('@number.float', { link = 'Float' }) -- Floating-point number literals. + + -- Types + hl.set('@type', { link = 'Type' }) -- Type (and class) definitions and annotations. + hl.set('@type.builtin', { link = 'Type' }) -- Built-in types: `i32` in Rust. + hl.set('@type.definition', { link = 'Type' }) -- Identifiers in type definitions (e.g. `typedef ` in C) + hl.set('@type.qualifier', { link = 'Type' }) -- Type qualifiers (e.g. `const`) + hl.set('@attribute', { fg = colors.other_keywords }) -- Annotations that can be attached to the code to denote some kind of meta information. e.g. C++/Dart attributes. + hl.set('@property', { link = '@variable.member' }) -- The key in key/value pairs + + -- Functions + hl.set('@function', { link = 'Function' }) -- Function definitions. + hl.set('@function.builtin', { link = 'Function' }) -- Built-in functions: `print` in Lua. + hl.set('@function.call', { link = 'Function' }) -- Function calls + hl.set('@function.macro', { link = 'Function' }) -- Macro defined functions (calls and definitions): each `macro_rules` in Rust. + hl.set('@function.method', { link = 'Function' }) -- Method definitions. + hl.set('@function.method.call', { link = 'Function' }) -- Method calls. + hl.set('@constructor', { link = 'Function' }) -- Constructor calls and definitions: `{}` in Lua, and Java constructors. + hl.set('@operator', { link = 'Operator' }) -- Binary or unary operators: `+`, and also `->` and `*` in C. + + -- Keywords + hl.set('@keyword', { link = 'Keyword' }) -- Keywords that don't fit into other categories. + hl.set('@keyword.coroutine', { link = 'MellifluousMainKeyword' }) -- Keywords related to coroutines (e.g. `go` in Go, `async/await` in Python) + hl.set('@keyword.function', { link = 'MellifluousMainKeyword' }) -- Keywords used to define a function: `function` in Lua, `def` and `lambda` in Python. + hl.set('@keyword.operator', { fg = colors.other_keywords, style = config.styles.operators }) -- Unary and binary operators that are English words: `and`, `or` in Python; `sizeof` in C. + hl.set('@keyword.import', { link = 'Function' }) -- File or module inclusion keywords: `#include` in C, `use` or `extern crate` in Rust. + hl.set('@keyword.storage', { link = 'StorageClass' }) -- Keywords that affect how a variable is stored: `static`, `comptime`, `extern`, etc. + hl.set('@keyword.repeat', { link = 'Repeat' }) -- Keywords related to loops: `for`, `while`, etc. + hl.set('@keyword.return', { link = 'MellifluousMainKeyword' }) -- Keywords like `return` and `yield`. + hl.set('@keyword.debug', { link = 'Keyword' }) -- Debugging statements. + hl.set('@keyword.exception', { link = 'Exception' }) -- Exception related keywords: `try`, `except`, `finally` in Python. + hl.set('@keyword.conditional', { link = 'Conditional' }) -- Keywords related to conditionals: `if`, `when`, `cond`, etc. + hl.set('@keyword.conditional.ternary', { link = 'Conditional' }) -- Ternary operator (e.g. `?` / `:`) + hl.set('@keyword.directive', { link = 'PreProc' }) -- Preprocessor #if, #else, #endif, etc. + hl.set('@keyword.directive.define', { link = 'PreProc' }) -- Preprocessor #define statements. + + -- Punctuation + hl.set('@punctuation.delimiter', { link = 'Operator', style = {} }) -- Punctuation delimiters: Periods, commas, semicolons, etc. + hl.set('@punctuation.bracket', { link = 'Operator', style = {} }) -- Brackets, braces, parentheses, etc. + hl.set('@punctuation.special', { link = 'Operator', style = {} }) -- Special punctuation that doesn't fit into the previous categories. + + -- Comments + hl.set('@comment', { link = 'Comment' }) -- Line comments and block comments. + hl.set('@comment.documentation', { fg = hl.get('@string.documentation').fg, style = hl.get('Comment').style }) -- Line comments and block comments. + hl.set('@comment.error', { bg = colors.bg:with_overlay(colors.ui_red, 20), fg = colors.ui_red }) -- Error-type comments (e.g., `DEPRECATED:`, `FIXME:`) + hl.set('@comment.warning', { bg = colors.bg:with_overlay(colors.ui_orange, 20), fg = colors.ui_orange }) -- Warning-type comments (e.g., `WARNING:`) + hl.set('@comment.note', { bg = colors.bg:with_overlay(colors.ui_purple, 20), fg = colors.ui_purple }) -- Note-type comments (e.g., `NOTE:`) + hl.set('@comment.info', { bg = colors.bg:with_overlay(colors.ui_blue, 20), fg = colors.ui_blue }) -- Info-type comments + hl.set('@comment.todo', { bg = colors.bg:with_overlay(colors.ui_green, 20), fg = colors.ui_green }) -- Todo-type comments (e.g. `TODO:`) + + -- Markup + hl.set('@markup', { bg = 'NONE' }) -- Non-structured text. Like text in a markup language. + hl.set('@markup.strong', { style = { bold = true } }) -- Text to be represented in bold. + hl.set('@markup.italic', { style = { italic = true } }) -- Text to be represented with emphasis. + hl.set('@markup.strikethrough', { style = { strikethrough = true } }) -- Strikethrough text. + hl.set('@markup.underline', { style = { underline = true } }) -- Text to be represented with an underline. + hl.set('@markup.heading', { fg = colors.other_keywords }) -- Text that is part of a title. + hl.set('@markup.quote', { fg = colors.other_keywords }) -- Quote blocks + hl.set('@markup.math', { fg = colors.other_keywords }) -- Math environments like LaTeX's `$ ... $` + hl.set('@markup.environment', { fg = colors.other_keywords }) -- Text environments of markup languages. + hl.set('@markup.environment.name', { link = '@markup.environment' }) -- Text/string indicating the type of text environment. Like the name of a `\begin` block in LaTeX. + hl.set('@markup.link', { fg = hl.get('@string.special.url').fg }) -- Footnotes, text references, citations, etc. + hl.set('@markup.link.label', { fg = colors.constants }) -- Link, reference descriptions + hl.set('@markup.link.url', { link = '@string.special.url' }) -- URIs like hyperlinks or email addresses. + hl.set('@markup.raw', { link = 'Character' }) -- Literal or verbatim text (e.g., inline code) + hl.set('@markup.raw.block', { link = 'Character' }) -- Literal or verbatim text as a stand-alone block + hl.set('@markup.list', { link = 'Operator' }) -- List markers + hl.set('@markup.list.unchecked', { link = 'Todo' }) -- Unchecked todo-style list markers + hl.set('@markup.list.checked', { fg = hl.get('@markup.list.unchecked').fg, bg = 'NONE' }) -- Checked todo-style list markers + hl.set('@diff.plus', { link = 'DiffAdd' }) -- added text (for diff files) + hl.set('@diff.minus', { link = 'DiffDelete' }) -- deleted text (for diff files) + hl.set('@diff.delta', { link = 'DiffChange' }) -- changed text (for diff files) + hl.set('@tag', { link = 'Keyword' }) -- Tags like HTML tag names. + hl.set('@tag.attribute', { link = 'Function', style = {} }) -- HTML tag attributes. + hl.set('@tag.delimiter', { link = 'Operator', style = {} }) -- Tag delimiters like `<` `>` `/`. + + + -- For compatitibilty with older neovim versions (TODO: remove after a few months) + hl.set("@parameter", { link = "@variable.parameter" }) + hl.set("@field", { link = "@variable.member" }) + hl.set("@namespace", { link = "@module" }) + hl.set("@float", { link = "number.float" }) + hl.set("@symbol", { link = "@string.special.symbol" }) + hl.set("@string.regex", { link = "@string.regexp" }) + + hl.set("@text", { link = "@markup" }) + hl.set("@text.strong", { link = "@markup.strong" }) + hl.set("@text.emphasis", { link = "@markup.italic" }) + hl.set("@text.underline", { link = "@markup.underline" }) + hl.set("@text.strike", { link = "@markup.strikethrough" }) + hl.set("@text.uri", { link = "@string.special.url" }) + hl.set("@text.math", { link = "@markup.math" }) + hl.set("@text.reference", { link = "@markup.link" }) + hl.set("@text.environment", { link = "@markup.environment" }) + hl.set("@text.environment.name", { link = "@markup.environment.name" }) + hl.set("@text.title", { link = "@markup.heading" }) + hl.set("@text.literal", { link = "@markup.raw" }) + + hl.set("@text.danger", { link = "comment.error" }) + hl.set("@text.warning", { link = "comment.warning" }) + hl.set("@text.note", { link = "comment.note" }) + hl.set("@text.todo", { link = "comment.todo" }) + + hl.set("@method", { link = "@function.method" }) + hl.set("@define", { link = "@keyword.directive.define" }) + hl.set("@preproc", { link = "@keyword.directive" }) + hl.set("@storage.class", { link = "@keyword.storage" }) + hl.set("@conditional", { link = "@keyword.conditional" }) + hl.set("@exception", { link = "@keyword.exception" }) + hl.set("@include", { link = "@keyword.import" }) + hl.set("@repeat", { link = "@keyword.repeat" }) + hl.set("@debug", { link = "@keyword.debug" }) end return M