gruber-darker.nvim/lua/gruber-darker/highlights/vim.lua

220 lines
13 KiB
Lua
Raw Normal View History

2023-03-26 16:06:15 +02:00
local Highlight = require("gruber-darker.highlight")
2023-03-30 03:50:44 +02:00
local c = require("gruber-darker.palette").default
local opts = require("gruber-darker.config").get_opts()
2023-03-26 01:10:26 +01:00
2023-03-30 03:50:44 +02:00
---@type HighlightsProvider
2023-03-26 01:10:26 +01:00
local M = {
highlights = {},
}
---Set standard Vim highlights
function M.setup()
for _, value in pairs(M.highlights) do
value:setup()
end
end
---any comment
2023-03-30 03:50:44 +02:00
M.highlights.comment = Highlight.new("Comment", { fg = c.brown, italic = opts.italic.comments })
2023-03-26 01:10:26 +01:00
---used for the columns set with 'colorcolumn'
2023-03-30 03:50:44 +02:00
M.highlights.color_column = Highlight.new("ColorColumn", { bg = c["bg+2"] })
2023-03-26 01:10:26 +01:00
---placeholder characters substituted for concealed text (see 'conceallevel')
2023-03-30 03:50:44 +02:00
M.highlights.conceal = Highlight.new("Conceal", { fg = c.fg, bg = c.bg })
2023-03-26 01:10:26 +01:00
---character under the cursor
2023-03-30 03:50:44 +02:00
M.highlights.cursor = Highlight.new("Cursor", { bg = c.yellow })
2023-03-26 01:10:26 +01:00
---the character under the cursor when |language-mapping| is used (see 'guicursor')
2023-03-30 03:50:44 +02:00
M.highlights.l_cursor = Highlight.new("lCursor", { fg = c.none, bg = c.yellow })
2023-03-26 01:10:26 +01:00
---like Cursor, but used when in IME mode |CursorIM|
2023-03-30 03:50:44 +02:00
M.highlights.cursor_im = Highlight.new("CursorIM", { fg = c.none, bg = c.yellow })
2023-03-26 01:10:26 +01:00
---Screen-column at the cursor, when 'cursorcolumn' is set.
2023-03-30 03:50:44 +02:00
M.highlights.cursor_column = Highlight.new("CursorColumn", { bg = c["bg+2"] })
2023-03-26 01:10:26 +01:00
---Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set.
2023-03-30 03:50:44 +02:00
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)
2023-03-26 01:10:26 +01:00
---diff mode: Added line |diff.txt|
2023-03-30 03:50:44 +02:00
M.highlights.diff_add = Highlight.new("DiffAdd", { fg = c.green, bg = c.none })
2023-03-26 01:10:26 +01:00
---diff mode: Changed line |diff.txt|
2023-03-30 03:50:44 +02:00
M.highlights.diff_change = Highlight.new("DiffChange", { fg = c.yellow, bg = c.none })
2023-03-26 01:10:26 +01:00
---diff mode: Deleted line |diff.txt|
2023-03-30 03:50:44 +02:00
M.highlights.diff_delete = Highlight.new("DiffDelete", { fg = c["red+1"], bg = c.none })
2023-03-26 01:10:26 +01:00
---diff mode: Changed text within a changed line |diff.txt|
2023-03-30 03:50:44 +02:00
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|.
M.highlights.end_of_buffer = Highlight.new("EndOfBuffer", { fg = c["bg+4"], bg = c.none })
2023-03-26 01:10:26 +01:00
---cursor in a focused terminal
2023-03-30 03:50:44 +02:00
M.highlights.term_cursor = Highlight.new("TermCursor", { bg = c.yellow })
2023-03-26 01:10:26 +01:00
---TermCursorNC= { }, ---cursor in an unfocused terminal
---error messages on the command line
2023-03-30 03:50:44 +02:00
M.highlights.error_msg = Highlight.new("ErrorMsg", { fg = c.white, bg = c.red })
2023-03-26 01:10:26 +01:00
---the column separating vertically split windows
2023-03-30 03:50:44 +02:00
M.highlights.vert_split = Highlight.new("VertSplit", { fg = c["fg+2"], bg = c["bg+1"] })
2023-03-26 01:10:26 +01:00
---the column separating vertically split windows
2023-03-30 03:50:44 +02:00
M.highlights.win_separator = Highlight.new("WinSeparator", { fg = c["bg+2"], bold = opts.bold })
2023-03-26 01:10:26 +01:00
---line used for closed folds
2023-03-30 03:50:44 +02:00
M.highlights.folded = Highlight.new("Folded", { fg = c.brown, bg = c["fg+2"], italic = opts.italic.folds })
2023-03-26 01:10:26 +01:00
---'foldcolumn'
2023-03-30 03:50:44 +02:00
M.highlights.fold_column = Highlight.new("FoldColumn", { fg = c.brown, bg = c["fg+2"] })
2023-03-26 01:10:26 +01:00
---column where |signs| are displayed
2023-03-30 03:50:44 +02:00
M.highlights.sign_column = Highlight.new("SignColumn", { fg = c["bg+2"], bg = c.none })
2023-03-26 01:10:26 +01:00
---SignColumnSB = Highlight.new("SignColumnSB", { bg = c.bg_sidebar, fg = c.fg_gutter }) ---column where |signs| are displayed
---Substitute = Highlight.new("Substitute", { bg = c.red, fg = c.black }) ---|:substitute| replacement text highlighting
---Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.
2023-03-30 03:50:44 +02:00
M.highlights.line_number = Highlight.new("LineNr", { fg = c["bg+4"] })
2023-03-26 01:10:26 +01:00
---Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
2023-03-30 03:50:44 +02:00
M.highlights.cursor_line_number = Highlight.new("CursorLineNr", { fg = c.yellow })
2023-03-26 01:10:26 +01:00
---The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt|
2023-03-30 03:50:44 +02:00
M.highlights.match_paren = Highlight.new("MatchParen", { fg = c.fg, bg = c.wisteria })
2023-03-26 01:10:26 +01:00
---'showmode' message (e.g., "---INSERT ---")
2023-03-30 03:50:44 +02:00
M.highlights.mode_msg = Highlight.new("ModeMsg", { fg = c["fg+2"] })
2023-03-26 01:10:26 +01:00
---MsgArea = Highlight.new("MsgArea", { fg = c.fg_dark }) ---Area for messages and cmdline
---MsgSeparator= { }, ---Separator for scrolled messages, `msgsep` flag of 'display'
---|more-prompt|
2023-03-30 03:50:44 +02:00
M.highlights.more_msg = Highlight.new("MoreMsg", { fg = c["fg+2"] })
2023-03-26 01:10:26 +01:00
---'@' 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|.
2023-03-30 03:50:44 +02:00
M.highlights.non_text = Highlight.new("NonText", { fg = c["fg+2"] })
2023-03-26 01:10:26 +01:00
---normal text
2023-03-30 03:50:44 +02:00
M.highlights.normal = Highlight.new("Normal", { fg = c.fg, bg = c.bg })
2023-03-26 01:10:26 +01:00
---normal text in non-current windows
2023-03-30 03:50:44 +02:00
M.highlights.normal_non_current = Highlight.new("NormalNC", { fg = c.fg, bg = c["bg-1"] })
2023-03-26 01:10:26 +01:00
---normal text in sidebar
2023-03-30 03:50:44 +02:00
M.highlights.normal_sidebar = Highlight.new("NormalSB", { fg = c.fg, bg = c["bg-1"] })
2023-03-26 01:10:26 +01:00
---Normal text in floating windows.
2023-03-30 03:50:44 +02:00
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"] })
2023-03-26 01:10:26 +01:00
---Popup menu: normal item.
2023-03-30 03:50:44 +02:00
M.highlights.popup_menu = Highlight.new("Pmenu", { fg = c.fg, bg = c["bg+1"] })
2023-03-26 01:10:26 +01:00
---Popup menu: selected item.
2023-03-30 03:50:44 +02:00
M.highlights.popup_menu_sel = Highlight.new("PmenuSel", { fg = c.fg, bg = c["bg+2"] })
2023-03-26 01:10:26 +01:00
---Popup menu: scrollbar.
2023-03-30 03:50:44 +02:00
M.highlights.popup_menu_sidebar = Highlight.new("PmenuSbar", { bg = c.bg })
2023-03-26 01:10:26 +01:00
---Popup menu: Thumb of the scrollbar.
2023-03-30 03:50:44 +02:00
M.highlights.popup_menu_thumb = Highlight.new("PmenuThumb", { bg = c.bg })
2023-03-26 01:10:26 +01:00
---|hit-enter| prompt and yes/no questions
2023-03-30 03:50:44 +02:00
M.highlights.question = Highlight.new("Question", { fg = c.niagara })
2023-03-26 01:10:26 +01:00
---Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there.
2023-03-30 03:50:44 +02:00
M.highlights.quick_fix_line = Highlight.new("QuickFixLine", { bg = c["bg+2"], bold = opts.bold })
2023-03-26 01:10:26 +01:00
---Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out.
2023-03-30 03:50:44 +02:00
M.highlights.search = Highlight.new("Search", { fg = c.black, bg = c.yellow })
2023-03-26 01:10:26 +01:00
---'incsearch' highlighting; also used for the text replaced with ":s///c"
2023-03-30 03:50:44 +02:00
M.highlights.incremental_search = Highlight.new("IncSearch", { fg = c.black, bg = c["fg+2"] })
2023-03-26 01:10:26 +01:00
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|
2023-03-30 03:50:44 +02:00
M.highlights.special_key = Highlight.new("SpecialKey", { fg = c["fg+2"] })
2023-03-26 01:10:26 +01:00
---Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise.
M.highlights.spell_bad = Highlight.new("SpellBad", { undercurl = true })
---Word that should start with a capital. |spell| Combined with the highlighting used otherwise.
M.highlights.spell_cap = Highlight.new("SpellCap", { undercurl = true })
---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 })
---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
2023-03-30 03:50:44 +02:00
M.highlights.status_line = Highlight.new("StatusLine", { fg = c.white, bg = c["bg+1"] })
2023-03-26 01:10:26 +01:00
---status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window.
2023-03-30 03:50:44 +02:00
M.highlights.status_line_non_current = Highlight.new("StatusLineNC", { fg = c.quartz, bg = c["bg+1"] })
2023-03-26 01:10:26 +01:00
---tab pages line, not active tab page label
2023-03-30 03:50:44 +02:00
M.highlights.tab_line = Highlight.new("TabLine", { bg = c.none })
2023-03-26 01:10:26 +01:00
---tab pages line, where there are no labels
2023-03-30 03:50:44 +02:00
M.highlights.tab_line_fill = Highlight.new("TabLineFill", { fg = c["bg+4"], bg = c["bg+1"] })
2023-03-26 01:10:26 +01:00
---tab pages line, active tab page label
2023-03-30 03:50:44 +02:00
M.highlights.tab_line_sel = Highlight.new("TabLineSel", { fg = c.yellow, bg = c.none, bold = opts.bold })
2023-03-26 01:10:26 +01:00
---titles for output from ":set all", ":autocmd" etc.
2023-03-30 03:50:44 +02:00
M.highlights.title = Highlight.new("Title", { fg = c.quartz })
2023-03-26 01:10:26 +01:00
---Visual mode selection
2023-03-30 03:50:44 +02:00
M.highlights.visual = Highlight.new("Visual", { bg = c["bg+2"] })
2023-03-26 01:10:26 +01:00
---Visual mode selection when vim is "Not Owning the Selection".
2023-03-30 03:50:44 +02:00
M.highlights.visual_nos = Highlight.new("VisualNOS", { fg = c.red })
2023-03-26 01:10:26 +01:00
---warning messages
2023-03-30 03:50:44 +02:00
M.highlights.warning_msg = Highlight.new("WarningMsg", { fg = c.red })
2023-03-26 01:10:26 +01:00
---"nbsp", "space", "tab" and "trail" in 'listchars'
2023-03-30 03:50:44 +02:00
M.highlights.whitespace = Highlight.new("Whitespace", { fg = c["bg+4"], bg = c.none })
2023-03-26 01:10:26 +01:00
---current match in 'wildmenu' completion
2023-03-30 03:50:44 +02:00
M.highlights.wild_menu = Highlight.new("WildMenu", { fg = c.black, bg = c.yellow })
---These groups are not listed as vim groups,
2023-03-26 01:10:26 +01:00
---but they are defacto standard group names for syntax highlighting.
---commented out groups should chain up to their "preferred" group by
2023-03-30 03:50:44 +02:00
--,
2023-03-26 01:10:26 +01:00
---Uncomment and edit if you want more specific syntax highlighting.
---(preferred) any constant
2023-03-30 03:50:44 +02:00
M.highlights.constant = Highlight.new("Constant", { fg = c.quartz })
2023-03-26 01:10:26 +01:00
--- a string constant: "this is a string"
2023-03-30 03:50:44 +02:00
M.highlights.string = Highlight.new("String", { fg = c.green, italic = opts.italic.strings })
2023-03-26 01:10:26 +01:00
--- a character constant: 'c', '\n'
2023-03-30 03:50:44 +02:00
M.highlights.character = Highlight.new("Character", { fg = c.green, italic = opts.italic.strings })
2023-03-26 01:10:26 +01:00
--- a number constant: 234, 0xff
2023-03-30 03:50:44 +02:00
M.highlights.number = Highlight.new("Number", { fg = c.fg })
2023-03-26 01:10:26 +01:00
--- a boolean constant: TRUE, false
2023-03-30 03:50:44 +02:00
M.highlights.boolean = Highlight.new("Boolean", { fg = c.yellow, bold = opts.bold })
2023-03-26 01:10:26 +01:00
--- a floating point constant: 2.3e10
2023-03-30 03:50:44 +02:00
M.highlights.float = Highlight.new("Float", { fg = c.yellow, bold = opts.bold })
2023-03-26 01:10:26 +01:00
---(preferred) any variable name
2023-03-30 03:50:44 +02:00
M.highlights.identifier = Highlight.new("Identifier", { fg = c["fg+1"] })
2023-03-26 01:10:26 +01:00
---function name (also: methods for classes)
2023-03-30 03:50:44 +02:00
M.highlights.func = Highlight.new("Function", { fg = c.niagara })
2023-03-26 01:10:26 +01:00
---(preferred) any statement
2023-03-30 03:50:44 +02:00
M.highlights.statement = Highlight.new("Statement", { fg = c.yellow })
2023-03-26 01:10:26 +01:00
---if, then, else, endif, switch, etc.
2023-03-30 03:50:44 +02:00
M.highlights.conditional = Highlight.new("Conditional", { fg = c.yellow, bold = opts.bold })
2023-03-26 01:10:26 +01:00
---for, do, while, etc.
2023-03-30 03:50:44 +02:00
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 })
2023-03-26 01:10:26 +01:00
---"sizeof", "+", "*", etc.
2023-03-30 03:50:44 +02:00
M.highlights.operator = Highlight.new("Operator", { fg = c.yellow, italic = opts.italic.operators })
2023-03-26 01:10:26 +01:00
---any other keyword
2023-03-30 03:50:44 +02:00
M.highlights.keyword = Highlight.new("Keyword", { fg = c.yellow, bold = opts.bold })
2023-03-26 01:10:26 +01:00
---try, catch, throw
2023-03-30 03:50:44 +02:00
M.highlights.exception = Highlight.new("Exception", { fg = c.yellow, bold = opts.bold })
2023-03-26 01:10:26 +01:00
---(preferred) generic Preprocessor
2023-03-30 03:50:44 +02:00
M.highlights.pre_proc = Highlight.new("PreProc", { fg = c.quartz })
2023-03-26 01:10:26 +01:00
---preprocessor #include
2023-03-30 03:50:44 +02:00
M.highlights.include = Highlight.new("Include", { fg = c.quartz })
2023-03-26 01:10:26 +01:00
---preprocessor #define
2023-03-30 03:50:44 +02:00
M.highlights.define = Highlight.new("Define", { fg = c.quartz })
2023-03-26 01:10:26 +01:00
---same as Define
2023-03-30 03:50:44 +02:00
M.highlights.macro = Highlight.new("Macro", { fg = c.quartz })
2023-03-26 01:10:26 +01:00
---preprocessor #if, #else, #endif, etc.
2023-03-30 03:50:44 +02:00
M.highlights.pre_condit = Highlight.new("PreCondit", { fg = c.quartz })
2023-03-26 01:10:26 +01:00
---(preferred) int, long, char, etc.
2023-03-30 03:50:44 +02:00
M.highlights.type = Highlight.new("Type", { fg = c.quartz })
2023-03-26 01:10:26 +01:00
---static, register, volatile, etc.
2023-03-30 03:50:44 +02:00
M.highlights.storage_class = Highlight.new("StorageClass", { fg = c.yellow, bold = opts.bold })
2023-03-26 01:10:26 +01:00
---struct, union, enum, etc.
2023-03-30 03:50:44 +02:00
M.highlights.structure = Highlight.new("Structure", { fg = c.yellow, bold = opts.bold })
2023-03-26 01:10:26 +01:00
---A typedef
2023-03-30 03:50:44 +02:00
M.highlights.typedef = Highlight.new("Typedef", { fg = c.yellow, bold = opts.bold })
2023-03-26 01:10:26 +01:00
---(preferred) any special symbol
2023-03-30 03:50:44 +02:00
M.highlights.special = Highlight.new("Special", { fg = c.yellow })
2023-03-26 01:10:26 +01:00
---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
2023-03-30 03:50:44 +02:00
---Debug = Highlight.new("Debug", { fg = c["fg+2"] }) --- debugging statements
2023-03-26 01:10:26 +01:00
---(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.italic = Highlight.new("Italic", { italic = true })
2023-03-26 01:10:26 +01:00
---("Ignore", below, may be invisible...)
---Ignore = Highlight.new("Ignore", { }) ---(preferred) left blank, hidden |hl-Ignore|
---Error = Highlight.new("Error", { fg = c.error }) ---(preferred) any erroneous construct
---(preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX
2023-03-30 03:50:44 +02:00
M.highlights.todo = Highlight.new("Todo", { fg = c.bg, bg = c.yellow })
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 })
2023-03-26 01:10:26 +01:00
---markdownH1 = Highlight.new("markdownH1", { fg = c.magenta, bold = true })
---markdownH2 = Highlight.new("markdownH2", { fg = c.blue, bold = true })
---markdownLinkText = Highlight.new("markdownLinkText", { fg = c.blue, underline = true })
2023-03-30 03:50:44 +02:00
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_code_delim = Highlight.new("markdownCodeDelimiter", { fg = c.brown, italic = true })
M.highlights.md_error = Highlight.new("markdownError", { fg = c.fg, bg = c["bg+1"] })
2023-03-26 01:10:26 +01:00
return M