nvim: Sync with changes to nvim-highlite upstream
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
d59e74f588
commit
b006265b14
2 changed files with 203 additions and 163 deletions
|
@ -214,12 +214,12 @@ local highlight_groups = {
|
|||
]]
|
||||
|
||||
--[[ 4.3.1. C ]]
|
||||
cConstant = {link='Constant'},
|
||||
cCustomClass = {link='Type' },
|
||||
cConstant = 'Constant',
|
||||
cCustomClass = 'Type' ,
|
||||
|
||||
--[[ 4.3.2. C++ ]]
|
||||
cppSTLexception = {link='Exception'},
|
||||
cppSTLnamespace = {link='String' },
|
||||
cppSTLexception = 'Exception',
|
||||
cppSTLnamespace = 'String' ,
|
||||
|
||||
--[[ 4.3.3 C# ]]
|
||||
csBraces = 'Delimiter',
|
||||
|
@ -227,6 +227,9 @@ local highlight_groups = {
|
|||
csClassType = 'Type',
|
||||
csContextualStatement = 'Conditional',
|
||||
csEndColon = 'Delimiter',
|
||||
csGeneric = 'Typedef',
|
||||
csInterpolation = 'Include',
|
||||
csInterpolationDelimiter = 'SpecialChar',
|
||||
csLogicSymbols = 'Operator',
|
||||
csModifier = 'Keyword',
|
||||
csNew = 'Operator',
|
||||
|
@ -258,34 +261,34 @@ local highlight_groups = {
|
|||
scssVariableAssignment = 'Operator',
|
||||
|
||||
--[[ 4.3.5. Dart ]]
|
||||
dartLibrary = {link='Statement'},
|
||||
dartLibrary = 'Statement',
|
||||
|
||||
--[[ 4.3.6. dot ]]
|
||||
dotKeyChar = {link='Character'},
|
||||
dotType = {link='Type' },
|
||||
dotKeyChar = 'Character',
|
||||
dotType = 'Type' ,
|
||||
|
||||
--[[ 4.3.7. Go ]]
|
||||
goBlock = {link='Delimiter' },
|
||||
goBoolean = {link='Boolean' },
|
||||
goBuiltins = {link='Operator' },
|
||||
goField = {link='Identifier' },
|
||||
goFloat = {link='Float' },
|
||||
goFormatSpecifier = {link='Character' },
|
||||
goFunction = {link='Function' },
|
||||
goFunctionCall = {link='goFunction' },
|
||||
goBlock = 'Delimiter' ,
|
||||
goBoolean = 'Boolean' ,
|
||||
goBuiltins = 'Operator' ,
|
||||
goField = 'Identifier',
|
||||
goFloat = 'Float' ,
|
||||
goFormatSpecifier = 'Character' ,
|
||||
goFunction = 'Function' ,
|
||||
goFunctionCall = 'goFunction',
|
||||
goFunctionReturn = {bg=NONE, fg=NONE, style=NONE},
|
||||
goMethodCall = {link='goFunctionCall' },
|
||||
goParamType = {link='goReceiverType' },
|
||||
goPointerOperator = {link='SpecialChar' },
|
||||
goPredefinedIdentifiers = {link='Constant' },
|
||||
goReceiver = {link='goBlock' },
|
||||
goReceiverType = {link='goTypeName' },
|
||||
goSimpleParams = {link='goBlock' },
|
||||
goType = {link='Type' },
|
||||
goTypeConstructor = {link='goFunction' },
|
||||
goTypeName = {link='Type' },
|
||||
goVarAssign = {link='Identifier' },
|
||||
goVarDefs = {link='goVarAssign' },
|
||||
goMethodCall = 'goFunctionCall',
|
||||
goParamType = 'goReceiverType',
|
||||
goPointerOperator = 'SpecialChar' ,
|
||||
goPredefinedIdentifiers = 'Constant' ,
|
||||
goReceiver = 'goBlock' ,
|
||||
goReceiverType = 'goTypeName' ,
|
||||
goSimpleParams = 'goBlock' ,
|
||||
goType = 'Type' ,
|
||||
goTypeConstructor = 'goFunction' ,
|
||||
goTypeName = 'Type' ,
|
||||
goVarAssign = 'Identifier' ,
|
||||
goVarDefs = 'goVarAssign' ,
|
||||
|
||||
--[[ 4.3.8. HTML ]]
|
||||
htmlArg = 'Label',
|
||||
|
@ -305,13 +308,13 @@ local highlight_groups = {
|
|||
htmlTagName = 'Type',
|
||||
|
||||
--[[ 4.3.9. Java ]]
|
||||
javaClassDecl = {link='Structure'},
|
||||
javaClassDecl = 'Structure',
|
||||
|
||||
--[[ 4.3.10. JavaScript ]]
|
||||
jsFuncBlock = {link='Function' },
|
||||
jsObjectKey = {link='Type' },
|
||||
jsReturn = {link='Keyword' },
|
||||
jsVariableDef = {link='Identifier'},
|
||||
jsFuncBlock = 'Function' ,
|
||||
jsObjectKey = 'Type' ,
|
||||
jsReturn = 'Keyword' ,
|
||||
jsVariableDef = 'Identifier',
|
||||
|
||||
--[[ 4.3.11. JSON ]]
|
||||
jsonBraces = 'luaBraces',
|
||||
|
@ -322,8 +325,8 @@ local highlight_groups = {
|
|||
jsonStringSQError = 'Exception',
|
||||
|
||||
--[[ 4.3.12. Make ]]
|
||||
makeCommands = {link='Statment'},
|
||||
makeSpecTarget = {link='Type' },
|
||||
makeCommands = 'Statment',
|
||||
makeSpecTarget = 'Type' ,
|
||||
|
||||
--[[ 4.3.13. Markdown ]]
|
||||
markdownH1 = {bg=NONE, fg=green_dark, style='bold' },
|
||||
|
@ -333,89 +336,98 @@ local highlight_groups = {
|
|||
markdownH5 = {bg=NONE, fg=orange, style='bold' },
|
||||
markdownH6 = {bg=NONE, fg=yellow, style='bold' },
|
||||
mkdBold = {bg=NONE, fg='green', style='bold' },
|
||||
mkdCode = {link='Comment' },
|
||||
mkdCodeDelimiter = {link='Delimiter' },
|
||||
mkdItalic = {bg=NONE, fg=green, style='italic'},
|
||||
mkdListItem = {link='Special' },
|
||||
mkdNonListItemBlock = {link='Normal' },
|
||||
texMathZoneY = {link='String' },
|
||||
mkdBold = 'SpecialComment',
|
||||
mkdCode = 'Statement',
|
||||
mkdCodeDelimiter = 'mkdBold',
|
||||
mkdCodeStart = 'mkdCodeDelimiter',
|
||||
mkdCodeEnd = 'mkdCodeStart',
|
||||
mkdHeading = 'Delimiter',
|
||||
mkdItalic = 'mkdBold',
|
||||
mkdListItem = 'Special',
|
||||
mkdRule = 'Underlined',
|
||||
texMathMatcher = 'Number',
|
||||
texMathZoneX = 'Number',
|
||||
texMathZoneY = 'Number',
|
||||
|
||||
--[[ 4.3.20. Python ]]
|
||||
pythonBrackets = {link='Delimiter' },
|
||||
pythonBuiltinFunc = {link='Operator' },
|
||||
pythonBuiltinObj = {link='Type' },
|
||||
pythonBuiltinType = {link='Type' },
|
||||
pythonClass = {link='Structure' },
|
||||
pythonClassParameters = {link='pythonParameters'},
|
||||
pythonDecorator = {link='PreProc' },
|
||||
pythonDottedName = {link='Identifier' },
|
||||
pythonError = {link='Error' },
|
||||
pythonException = {link='Exception' },
|
||||
pythonInclude = {link='Include' },
|
||||
pythonIndentError = {link='pythonError' },
|
||||
pythonLambdaExpr = {link='pythonOperator' },
|
||||
pythonOperator = {link='Operator' },
|
||||
pythonParam = {link='Identifier' },
|
||||
pythonParameters = {link='Delimiter' },
|
||||
pythonSelf = {link='Statement' },
|
||||
pythonSpaceError = {link='pythonError' },
|
||||
pythonStatement = {link='Statement' },
|
||||
pythonBrackets = 'Delimiter' ,
|
||||
pythonBuiltinFunc = 'Operator' ,
|
||||
pythonBuiltinObj = 'Type' ,
|
||||
pythonBuiltinType = 'Type' ,
|
||||
pythonClass = 'Structure' ,
|
||||
pythonClassParameters = 'pythonParameters',
|
||||
pythonDecorator = 'PreProc' ,
|
||||
pythonDottedName = 'Identifier' ,
|
||||
pythonError = 'Error' ,
|
||||
pythonException = 'Exception' ,
|
||||
pythonInclude = 'Include' ,
|
||||
pythonIndentError = 'pythonError' ,
|
||||
pythonLambdaExpr = 'pythonOperator' ,
|
||||
pythonOperator = 'Operator' ,
|
||||
pythonParam = 'Identifier' ,
|
||||
pythonParameters = 'Delimiter' ,
|
||||
pythonSelf = 'Statement' ,
|
||||
pythonSpaceError = 'pythonError' ,
|
||||
pythonStatement = 'Statement' ,
|
||||
|
||||
--[[ 4.3.21. Ruby ]]
|
||||
rubyClass = {link='Structure'},
|
||||
rubyDefine = {link='Define' },
|
||||
rubyInterpolationDelimiter = {link='Delimiter'},
|
||||
rubyClass = 'Structure',
|
||||
rubyDefine = 'Define' ,
|
||||
rubyInterpolationDelimiter = 'Delimiter',
|
||||
|
||||
--[[ 4.3.22. Rust ]]
|
||||
rustKeyword = {link='Keyword' },
|
||||
rustModPath = {link='Include' },
|
||||
rustScopeDecl = {link='Delimiter' },
|
||||
rustTrait = {link='StorageClass'},
|
||||
rustKeyword = 'Keyword' ,
|
||||
rustModPath = 'Include' ,
|
||||
rustScopeDecl = 'Delimiter' ,
|
||||
rustTrait = 'StorageClass',
|
||||
|
||||
--[[ 4.3.23. Scala ]]
|
||||
scalaKeyword = {link='Keyword' },
|
||||
scalaNameDefinition = {link='Identifier'},
|
||||
scalaKeyword = 'Keyword' ,
|
||||
scalaNameDefinition = 'Identifier',
|
||||
|
||||
--[[ 4.3.24. shell ]]
|
||||
shFunctionKey = {link='Function' },
|
||||
shLoop = {link='Repeat' },
|
||||
shSet = {link='Statement'},
|
||||
shTestOpr = {link='Debug' },
|
||||
shFunctionKey = 'Function' ,
|
||||
shLoop = 'Repeat' ,
|
||||
shSet = 'Statement',
|
||||
shTestOpr = 'Debug' ,
|
||||
|
||||
--[[ 4.3.25. Solidity ]]
|
||||
solBuiltinType = {link='Type' },
|
||||
solContract = {link='Typedef' },
|
||||
solContractName = {link='Function'},
|
||||
solBuiltinType = 'Type' ,
|
||||
solContract = 'Typedef' ,
|
||||
solContractName = 'Function',
|
||||
|
||||
--[[ 4.3.26. TOML ]]
|
||||
tomlComment = {link='Comment' },
|
||||
tomlKey = {link='Label' },
|
||||
tomlTable = {link='StorageClass'},
|
||||
tomlComment = 'Comment' ,
|
||||
tomlKey = 'Label' ,
|
||||
tomlTable = 'StorageClass',
|
||||
|
||||
--[[ 4.3.27. VimScript ]]
|
||||
vimCommand = {link = 'Keyword' },
|
||||
vimFuncKey = {link = 'Function' },
|
||||
vimGroup = {link = 'Type' },
|
||||
vimHiGroup = {link = 'Typedef' },
|
||||
vimIsCommand = {link = 'vimCommand'},
|
||||
vimLet = {link = 'Operator' },
|
||||
vimMap = {link = 'vimCommand'},
|
||||
helpSpecial = 'Special',
|
||||
vimFgBgAttrib = 'Constant',
|
||||
vimHiCterm = 'Label',
|
||||
vimHiCtermFgBg = 'vimHiCterm',
|
||||
vimHiGroup = 'Typedef',
|
||||
vimHiGui = 'vimHiCterm',
|
||||
vimHiGuiFgBg = 'vimHiGui',
|
||||
vimHiKeyList = 'Operator',
|
||||
vimOption = 'Define',
|
||||
vimSetEqual = 'Operator',
|
||||
|
||||
--[[ 4.3.28. XML ]]
|
||||
xmlAttrib = {link='Label' },
|
||||
xmlEndTag = {link='Exception'},
|
||||
xmlEqual = {link='Operator' },
|
||||
xmlTag = {link='Delimiter'},
|
||||
xmlTagName = {link='Define' },
|
||||
xmlAttrib = 'Label' ,
|
||||
xmlEndTag = 'Exception',
|
||||
xmlEqual = 'Operator' ,
|
||||
xmlTag = 'Delimiter',
|
||||
xmlTagName = 'Define' ,
|
||||
|
||||
--[[ 4.3.29 Haskell ]]
|
||||
haskellType = {link='Type' },
|
||||
haskellIdentifier = {link='Identifier' },
|
||||
haskellOperators = {link='Operator' },
|
||||
haskellWhere = {link='Keyword' },
|
||||
haskellDelimiter = {link='Delimiter' },
|
||||
haskellImportKeywords = {link='Include' },
|
||||
haskellStatement = {link='Statement' },
|
||||
haskellType = 'Type' ,
|
||||
haskellIdentifier = 'Identifier',
|
||||
haskellOperators = 'Operator' ,
|
||||
haskellWhere = 'Keyword' ,
|
||||
haskellDelimiter = 'Delimiter' ,
|
||||
haskellImportKeywords = 'Include' ,
|
||||
haskellStatement = 'Statement' ,
|
||||
|
||||
--[[ 4.3.30 Lua ]]
|
||||
luaBraces = 'Structure',
|
||||
|
@ -440,8 +452,8 @@ local highlight_groups = {
|
|||
missing.
|
||||
]]
|
||||
--[[ 4.4.1. ALE ]]
|
||||
ALEErrorSign = {link='ErrorMsg' },
|
||||
ALEWarningSign = {link='WarningMsg'},
|
||||
ALEErrorSign = 'ErrorMsg' ,
|
||||
ALEWarningSign = 'WarningMsg',
|
||||
|
||||
--[[ 4.4.2. coc.nvim ]]
|
||||
CocErrorHighlight = {bg=NONE, fg=NONE, style={'undercurl', color='red' }},
|
||||
|
@ -454,16 +466,16 @@ local highlight_groups = {
|
|||
CocWarningSign = {link='ALEWarningSign' },
|
||||
|
||||
--[[ 4.4.2. vim-jumpmotion / vim-easymotion ]]
|
||||
EasyMotion = {link = 'IncSearch' },
|
||||
JumpMotion = {link = 'EasyMotion'},
|
||||
EasyMotion = 'IncSearch' ,
|
||||
JumpMotion = 'EasyMotion',
|
||||
|
||||
--[[ 4.4.3. vim-markdown ]]
|
||||
htmlH1 = {link='markdownH1'},
|
||||
htmlH2 = {link='markdownH2'},
|
||||
htmlH3 = {link='markdownH3'},
|
||||
htmlH4 = {link='markdownH4'},
|
||||
htmlH5 = {link='markdownH5'},
|
||||
htmlH6 = {link='markdownH6'},
|
||||
htmlH1 = 'markdownH1',
|
||||
htmlH2 = 'markdownH2',
|
||||
htmlH3 = 'markdownH3',
|
||||
htmlH4 = 'markdownH4',
|
||||
htmlH5 = 'markdownH5',
|
||||
htmlH6 = 'markdownH6',
|
||||
|
||||
--[[ 4.4.4. vim-gitgutter / vim-signify ]]
|
||||
GitGutterAdd = {bg=NONE, fg=green, style=NONE},
|
||||
|
@ -471,38 +483,47 @@ local highlight_groups = {
|
|||
GitGutterDelete = {bg=NONE, fg=red, style=NONE},
|
||||
GitGutterChangeDelete = {bg=NONE, fg=orange, style=NONE},
|
||||
|
||||
SignifySignAdd = {link='GitGutterAdd' },
|
||||
SignifySignChange = {link='GitGutterChange' },
|
||||
SignifySignDelete = {link='GitGutterDelete' },
|
||||
SignifySignChangeDelete = {link='GitGutterChangeDelete'},
|
||||
SignifySignAdd = 'GitGutterAdd' ,
|
||||
SignifySignChange = 'GitGutterChange' ,
|
||||
SignifySignDelete = 'GitGutterDelete' ,
|
||||
SignifySignChangeDelete = 'GitGutterChangeDelete',
|
||||
|
||||
--[[ 4.4.5. vim-indent-guides ]]
|
||||
IndentGuidesOdd = {bg=darkgrey, fg=NONE, style=NONE},
|
||||
IndentGuidesEven = {bg=grey, fg=NONE, style=NONE},
|
||||
|
||||
--[[ 4.4.7. NERDTree ]]
|
||||
NERDTreeCWD = {link='Label' },
|
||||
NERDTreeUp = {link='Operator' },
|
||||
NERDTreeDir = {link='Directory' },
|
||||
NERDTreeDirSlash = {link='Delimiter' },
|
||||
NERDTreeOpenable = {link='NERDTreeDir' },
|
||||
NERDTreeClosable = {link='NERDTreeOpenable'},
|
||||
NERDTreeExecFile = {link='Function' },
|
||||
NERDTreeLinkTarget = {link='Tag' },
|
||||
NERDTreeCWD = 'Label' ,
|
||||
NERDTreeUp = 'Operator' ,
|
||||
NERDTreeDir = 'Directory' ,
|
||||
NERDTreeDirSlash = 'Delimiter' ,
|
||||
NERDTreeOpenable = 'NERDTreeDir' ,
|
||||
NERDTreeClosable = 'NERDTreeOpenable',
|
||||
NERDTreeExecFile = 'Function' ,
|
||||
NERDTreeLinkTarget = 'Tag' ,
|
||||
|
||||
--[[ 4.4.8 SearchLight ]]
|
||||
--[[ 4.4.8. nvim-treesitter ]]
|
||||
TSConstBuiltin = 'Constant',
|
||||
TSConstructor = 'Typedef',
|
||||
TSFuncBuiltin = 'Function',
|
||||
TSStringEscape = 'Character',
|
||||
TSStringRegex = 'SpecialChar',
|
||||
TSURI = 'Tag',
|
||||
TSVariableBuiltin = 'Identifier',
|
||||
|
||||
--[[ 4.4.9 SearchLight ]]
|
||||
SearchLight = {bg=black, fg=orange, style={'bold', 'italic', 'underline'}},
|
||||
|
||||
--[[ 4.4.9 Sneak ]]
|
||||
--[[ 4.4.10 Sneak ]]
|
||||
Sneak = {bg=red, fg=black, style='bold' },
|
||||
SneakScope = {bg=black, fg=orange, style={'bold', 'underline'}},
|
||||
|
||||
--[[ 4.4.10 Which key ]]
|
||||
WhichKey = {link='Function' },
|
||||
WhichKeySeperator = {link='DiffAdded' },
|
||||
WhichKeyGroup = {link='Keyword' },
|
||||
--[[ 4.4.11 Which key ]]
|
||||
WhichKey = 'Function' ,
|
||||
WhichKeySeperator = 'DiffAdded',
|
||||
WhichKeyGroup = 'Keyword' ,
|
||||
WhichKeyDesc = {bg=black, fg=orange, style=NONE },
|
||||
WhichKeyFloating = {link='Pmenu' },
|
||||
WhichKeyFloating = 'Pmenu' ,
|
||||
}
|
||||
|
||||
-- We do not care about terminals which do not support 256 colors
|
||||
|
|
|
@ -4,9 +4,6 @@ local vim = vim
|
|||
-- Clear the highlighting.
|
||||
vim.cmd('hi clear')
|
||||
|
||||
-- Set the background to dark.
|
||||
vim.o.background = 'dark'
|
||||
|
||||
-- Disable automatic coloring for the IndentGuides plugin.
|
||||
vim.g.indent_guides_auto_colors = 0
|
||||
|
||||
|
@ -14,51 +11,77 @@ vim.g.indent_guides_auto_colors = 0
|
|||
if vim.fn.exists('syntax_on') then vim.cmd('syntax reset') end
|
||||
|
||||
-- Determine which set of colors to use.
|
||||
local use_hex_and_256 = string.find(vim.fn.expand('$TERM'), '256')
|
||||
or vim.g.t_Co >= 256
|
||||
local using_hex_or_256 = tonumber(vim.o.t_Co) >= 256
|
||||
or vim.o.termguicolors
|
||||
or vim.fn.has('gui_running')
|
||||
or string.find(vim.fn.expand('$TERM'), '256')
|
||||
|
||||
-- If we aren't using the hex and 256 colorset, then set the &t_Co variable to 16.
|
||||
if not use_hex_and_256 then vim.g.t_Co = 16 end
|
||||
if not using_hex_or_256 then vim.o.t_Co = 16 end
|
||||
|
||||
-- These are constants for the indexes in the colors that were defined before.
|
||||
local BIT_16 = 3
|
||||
local BIT_256 = 2
|
||||
local HEX = 1
|
||||
local PALETTE_ANSI = 3
|
||||
local PALETTE_256 = 2
|
||||
local PALETTE_HEX = 1
|
||||
local NONE = "NONE"
|
||||
|
||||
-- Get the color value of a color variable, or "NONE" as a default.
|
||||
local function get(color, index)
|
||||
local function get(color, index) -- {{{ †
|
||||
if type(color) == 'table' and color[index] then
|
||||
return color[index]
|
||||
elseif type(color) == 'string' then
|
||||
return color
|
||||
else
|
||||
return "NONE"
|
||||
return NONE
|
||||
end
|
||||
end --}}} ‡
|
||||
|
||||
-- Add the 'blend' parameter to some highlight command, if there is one.
|
||||
local function blend(command, attributes) -- {{{ †
|
||||
if attributes.blend then -- There is a value for the `highlight-blend` field.
|
||||
command[#command + 1] = ' blend='..attributes.blend
|
||||
end
|
||||
end --}}} ‡
|
||||
|
||||
--[[ If using hex and 256-bit colors, then populate the gui* and cterm* args.
|
||||
If using 16-bit colors, just populate the cterm* args. ]]
|
||||
local colorize = use_hex_and_256 and function(command, attributes) command[#command + 1] =
|
||||
' ctermbg='..get(attributes.bg, BIT_256)
|
||||
..' ctermfg='..get(attributes.fg, BIT_256)
|
||||
..' guibg='..get(attributes.bg, HEX)
|
||||
..' guifg='..get(attributes.fg, HEX)
|
||||
end or function(command, attributes) command[#command + 1] =
|
||||
' ctermbg='..get(attributes.bg, BIT_16)
|
||||
..' ctermfg='..get(attributes.fg, BIT_16)
|
||||
end
|
||||
local colorize = using_hex_or_256 and function(command, attributes) -- {{{ †
|
||||
command[#command + 1] =
|
||||
' ctermbg='..get(attributes.bg, PALETTE_256)
|
||||
..' ctermfg='..get(attributes.fg, PALETTE_256)
|
||||
..' guibg='..get(attributes.bg, PALETTE_HEX)
|
||||
..' guifg='..get(attributes.fg, PALETTE_HEX)
|
||||
blend(command, attributes)
|
||||
end or function(command, attributes)
|
||||
command[#command + 1] =
|
||||
' ctermbg='..get(attributes.bg, PALETTE_ANSI)
|
||||
..' ctermfg='..get(attributes.fg, PALETTE_ANSI)
|
||||
blend(command, attributes)
|
||||
end --}}} ‡
|
||||
|
||||
-- This function appends `selected_attributes` to the end of `highlight_cmd`.
|
||||
local stylize = use_hex_and_256 and function(command, attributes)
|
||||
command[#command + 1] = ' cterm='..attributes..' gui='..attributes
|
||||
end or function(command, attributes)
|
||||
command[#command + 1] = ' cterm='..attributes
|
||||
local stylize = using_hex_or_256 and function(command, style, color) -- {{{ †
|
||||
command[#command + 1] = ' cterm='..style..' gui='..style
|
||||
|
||||
if color then -- There is an undercurl color.
|
||||
command[#command + 1] = ' guisp='..get(color, PALETTE_HEX)
|
||||
end
|
||||
end or function(command, style)
|
||||
command[#command + 1] = ' cterm='..style
|
||||
end --}}} ‡
|
||||
|
||||
-- Generate a `:highlight` command from a group and some attributes.
|
||||
local function highlight(highlight_group, attributes) -- {{{ †
|
||||
-- The base highlight command
|
||||
local highlight_cmd = {'hi! ', highlight_group}
|
||||
|
||||
-- Take care of special instructions for certain background colors.
|
||||
if attributes[vim.o.background] then
|
||||
attributes.__index = attributes
|
||||
attributes = setmetatable(attributes[vim.o.background], attributes)
|
||||
end
|
||||
|
||||
-- Determine if there is a highlight link, and if so, assign it.
|
||||
local link = (type(attributes) == 'string' and attributes)
|
||||
or attributes.link
|
||||
|
||||
|
@ -66,18 +89,14 @@ local function highlight(highlight_group, attributes) -- {{{ †
|
|||
highlight_cmd[3] = highlight_cmd[2]..' '
|
||||
highlight_cmd[2] = 'link '
|
||||
highlight_cmd[4] = link
|
||||
else -- the `highlight_group` is uniquely defined.
|
||||
else -- The `highlight_group` is uniquely defined.
|
||||
colorize(highlight_cmd, attributes)
|
||||
|
||||
local style = attributes.style
|
||||
local style = attributes.style or NONE
|
||||
if type(style) == 'table' then
|
||||
-- Concat all of the entries together with a comma between before styling.
|
||||
stylize(highlight_cmd, table.concat(style, ','))
|
||||
|
||||
if style.color then -- there won't is a color for undercurl.
|
||||
highlight_cmd[#highlight_cmd + 1] = ' guisp='..get(style.color, HEX)
|
||||
end
|
||||
else -- just style the single entry.
|
||||
stylize(highlight_cmd, table.concat(style, ','), style.color)
|
||||
else -- The style is just a single entry.
|
||||
stylize(highlight_cmd, style)
|
||||
end
|
||||
end
|
||||
|
@ -95,7 +114,7 @@ return function(Normal, highlights, terminal_ansi_colors)
|
|||
end
|
||||
|
||||
-- Set the terminal colors.
|
||||
for index, color in ipairs(terminal_ansi_colors) do
|
||||
vim.g['terminal_color_'..index] = color[HEX] or color[BIT_256] or color[BIT_16]
|
||||
end
|
||||
if using_hex_or_256 then for index, color in ipairs(terminal_ansi_colors) do
|
||||
vim.g['terminal_color_'..index] = vim.o.termguicolors and color[PALETTE_HEX] or color[PALETTE_256]
|
||||
end end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue