nvim: yolokai: Sync with nvim-highlite upstream
This commit is contained in:
parent
0eb9b86927
commit
3d8ccb4f23
2 changed files with 103 additions and 71 deletions
|
@ -229,43 +229,78 @@ local highlight_groups = {
|
||||||
cppSTLnamespace = 'String' ,
|
cppSTLnamespace = 'String' ,
|
||||||
|
|
||||||
--[[ 4.3.3 C# ]]
|
--[[ 4.3.3 C# ]]
|
||||||
csBraces = 'Delimiter' ,
|
csBraces = 'Delimiter',
|
||||||
csClass = 'Structure' ,
|
csClass = 'Structure',
|
||||||
csClassType = 'Type' ,
|
csClassType = 'Type',
|
||||||
csContextualStatement = 'Conditional' ,
|
csContextualStatement = 'Conditional',
|
||||||
csEndColon = 'Delimiter' ,
|
csEndColon = 'Delimiter',
|
||||||
csGeneric = 'Typedef' ,
|
csGeneric = 'Typedef',
|
||||||
csInterpolation = 'Include' ,
|
csInterpolation = 'Include',
|
||||||
csInterpolationDelimiter = 'SpecialChar' ,
|
csInterpolationDelimiter = 'SpecialChar',
|
||||||
csLogicSymbols = 'Operator' ,
|
csLogicSymbols = 'Operator',
|
||||||
csModifier = 'Keyword' ,
|
csModifier = 'Keyword',
|
||||||
csNew = 'Operator' ,
|
csNew = 'Operator',
|
||||||
csNewType = 'Type' ,
|
csNewType = 'Type',
|
||||||
csParens = 'Delimiter' ,
|
csParens = 'Delimiter',
|
||||||
csPreCondit = 'PreProc' ,
|
csPreCondit = 'PreProc',
|
||||||
csRepeat = 'Repeat' ,
|
csQuote = 'Delimiter',
|
||||||
csStorage = 'StorageClass',
|
csRepeat = 'Repeat',
|
||||||
csUnspecifiedStatement = 'Statement' ,
|
csStorage = 'StorageClass',
|
||||||
csXmlTag = 'Define' ,
|
csUnspecifiedStatement = 'Statement',
|
||||||
csXmlTagName = 'Define' ,
|
csXmlTag = 'Define',
|
||||||
|
csXmlTagName = 'Define',
|
||||||
|
razorCode = 'PreProc',
|
||||||
|
razorcsLHSMemberAccessOperator = 'Noise',
|
||||||
|
razorcsRHSMemberAccessOperator = 'razorcsLHSMemberAccessOperator',
|
||||||
|
razorcsStringDelimiter = 'razorhtmlValueDelimiter',
|
||||||
|
razorcsTypeNullable = 'Special',
|
||||||
|
razorcsUnaryOperatorKeyword = 'Operator',
|
||||||
|
razorDelimiter = 'Delimiter',
|
||||||
|
razorEventAttribute = 'PreCondit',
|
||||||
|
razorFor = 'razorIf',
|
||||||
|
razorhtmlAttribute = 'htmlArg',
|
||||||
|
razorhtmlAttributeOperator = 'Operator',
|
||||||
|
razorhtmlTag = 'htmlTag',
|
||||||
|
razorhtmlValueDelimiter = 'Delimiter',
|
||||||
|
razorIf = 'PreCondit',
|
||||||
|
razorImplicitExpression = 'PreProc',
|
||||||
|
razorLine = 'Constant',
|
||||||
|
razorUsing = 'Include',
|
||||||
|
|
||||||
--[[ 4.3.4. CSS ]]
|
--[[ 4.3.4. CSS ]]
|
||||||
cssBraces = 'Delimiter' ,
|
cssAtRule = 'PreCondit',
|
||||||
cssProp = 'Keyword' ,
|
cssAttr = 'Keyword',
|
||||||
cssSelectorOp = 'Operator' ,
|
cssAttrComma = 'Noise',
|
||||||
cssTagName = 'Type' ,
|
cssAttrRegion = 'Keyword',
|
||||||
cssTagName = 'htmlTagName',
|
cssBraces = 'Delimiter',
|
||||||
scssAmpersand = 'Special' ,
|
cssClassName = 'Identifier',
|
||||||
scssAttribute = 'Normal' ,
|
cssClassNameDot = 'Noise',
|
||||||
scssBoolean = 'Boolean' ,
|
cssFlexibleBoxAttr = 'cssAttr',
|
||||||
scssDefault = 'Keyword' ,
|
cssFunctionComma = 'Noise',
|
||||||
scssElse = 'PreCondit' ,
|
cssImportant = 'Exception',
|
||||||
scssIf = 'PreCondit' ,
|
cssNoise = 'Noise',
|
||||||
scssInclude = 'Include' ,
|
cssProp = 'Label',
|
||||||
scssSelectorChar = 'Operator' ,
|
cssPseudoClass = 'Special',
|
||||||
scssSelectorName = 'Label' ,
|
cssPseudoClassId = 'cssSelectorOp',
|
||||||
scssVariable = 'Define' ,
|
cssSelectorOp = 'Operator',
|
||||||
scssVariableAssignment = 'Operator' ,
|
cssTagName = 'Structure',
|
||||||
|
cssUnitDecorators = 'Type',
|
||||||
|
scssAmpersand = 'Special',
|
||||||
|
scssAttribute = 'Noise',
|
||||||
|
scssBoolean = 'Boolean',
|
||||||
|
scssDefault = 'Keyword',
|
||||||
|
scssElse = 'scssIf',
|
||||||
|
scssMixinName = function(self)
|
||||||
|
local super = self.cssClassName
|
||||||
|
return {bg = super.bg, fg=super.fg, style='Italic'}
|
||||||
|
end,
|
||||||
|
scssIf = 'PreCondit',
|
||||||
|
scssInclude = 'Include',
|
||||||
|
scssSelectorChar = 'Delimiter',
|
||||||
|
scssDefinition = 'PreProc',
|
||||||
|
scssSelectorName = 'Identifier',
|
||||||
|
scssVariable = 'Define',
|
||||||
|
scssVariableAssignment = 'Operator',
|
||||||
|
|
||||||
--[[ 4.3.5. Dart ]]
|
--[[ 4.3.5. Dart ]]
|
||||||
dartLibrary = 'Statement',
|
dartLibrary = 'Statement',
|
||||||
|
@ -454,22 +489,27 @@ local highlight_groups = {
|
||||||
haskellStatement = 'Statement' ,
|
haskellStatement = 'Statement' ,
|
||||||
|
|
||||||
--[[ 4.3.24 Lua ]]
|
--[[ 4.3.24 Lua ]]
|
||||||
luaBraces = 'Structure' ,
|
luaBraces = 'Structure',
|
||||||
luaBrackets = 'Delimiter' ,
|
luaBrackets = 'Delimiter',
|
||||||
luaBuiltin = 'Keyword' ,
|
luaBuiltin = 'Keyword',
|
||||||
luaComma = 'Delimiter' ,
|
luaComma = 'Delimiter',
|
||||||
luaFuncArgName = 'Identifier' ,
|
luaFuncArgName = 'Identifier',
|
||||||
luaFuncCall = 'Function' ,
|
luaFuncCall = 'Function',
|
||||||
luaFuncId = 'luaNoise' ,
|
luaFuncId = 'luaNoise',
|
||||||
luaFuncKeyword = 'Type' ,
|
luaFuncKeyword = 'Type',
|
||||||
luaFuncName = 'Function' ,
|
luaFuncName = 'Function',
|
||||||
luaFuncParens = 'Delimiter' ,
|
luaFuncParens = 'Delimiter',
|
||||||
luaFuncTable = 'Structure' ,
|
luaFuncTable = 'Structure',
|
||||||
luaLocal = 'Type' ,
|
luaIn = 'luaRepeat',
|
||||||
luaNoise = 'Delimiter' ,
|
luaLocal = 'Type',
|
||||||
luaParens = 'Delimiter' ,
|
luaNoise = 'Delimiter',
|
||||||
luaSpecialTable = 'StorageClass',
|
luaParens = 'Delimiter',
|
||||||
luaSpecialValue = 'Function' ,
|
luaSpecialTable = 'Structure',
|
||||||
|
luaSpecialValue = 'Function',
|
||||||
|
luaStringLongTag = function(self)
|
||||||
|
local delimiter = self.Delimiter
|
||||||
|
return {bg = delimiter.bg, fg=delimiter.fg, style='italic'}
|
||||||
|
end,
|
||||||
|
|
||||||
--[[ 4.3.25. SQL ]]
|
--[[ 4.3.25. SQL ]]
|
||||||
sqlKeyword = 'Keyword' ,
|
sqlKeyword = 'Keyword' ,
|
||||||
|
@ -480,6 +520,7 @@ local highlight_groups = {
|
||||||
|
|
||||||
--[[ 4.3.26. dos INI ]]
|
--[[ 4.3.26. dos INI ]]
|
||||||
dosiniHeader = 'Title',
|
dosiniHeader = 'Title',
|
||||||
|
dosiniLabel = 'Label',
|
||||||
|
|
||||||
--[[ 4.3.27. Crontab ]]
|
--[[ 4.3.27. Crontab ]]
|
||||||
crontabDay = 'StorageClass',
|
crontabDay = 'StorageClass',
|
||||||
|
@ -542,16 +583,6 @@ local highlight_groups = {
|
||||||
ALEErrorSign = 'ErrorMsg' ,
|
ALEErrorSign = 'ErrorMsg' ,
|
||||||
ALEWarningSign = 'WarningMsg',
|
ALEWarningSign = 'WarningMsg',
|
||||||
|
|
||||||
--[[ 4.4.2. coc.nvim ]]
|
|
||||||
CocErrorHighlight = {bg=NONE, fg=NONE, style={'undercurl', color='red' }},
|
|
||||||
CocErrorSign = 'ALEErrorSign',
|
|
||||||
CocHintHighlight = {bg=NONE, fg=NONE, style={'undercurl', color='purple' }},
|
|
||||||
CocHintSign = 'HintMsg',
|
|
||||||
CocInfoHighlight = {bg=NONE, fg=NONE, style={'undercurl', color='pink' }},
|
|
||||||
CocInfoSign = 'InfoMsg',
|
|
||||||
CocWarningHighlight = {bg=NONE, fg=NONE, style={'undercurl', color='orange' }},
|
|
||||||
CocWarningSign = 'ALEWarningSign',
|
|
||||||
|
|
||||||
--[[ 4.4.2. vim-jumpmotion / vim-easymotion ]]
|
--[[ 4.4.2. vim-jumpmotion / vim-easymotion ]]
|
||||||
EasyMotion = 'IncSearch' ,
|
EasyMotion = 'IncSearch' ,
|
||||||
JumpMotion = 'EasyMotion',
|
JumpMotion = 'EasyMotion',
|
||||||
|
|
|
@ -10,6 +10,7 @@ local vim = vim
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
local exe = api.nvim_command
|
local exe = api.nvim_command
|
||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
|
local go = vim.go
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
/*
|
/*
|
||||||
|
@ -18,16 +19,16 @@ local fn = vim.fn
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- These are constants for the indexes in the colors that were defined before.
|
-- These are constants for the indexes in the colors that were defined before.
|
||||||
local _NONE = 'NONE'
|
local _NONE = 'NONE'
|
||||||
local _PALETTE_256 = 2
|
local _PALETTE_256 = 2
|
||||||
local _PALETTE_ANSI = 3
|
local _PALETTE_ANSI = 3
|
||||||
local _PALETTE_HEX = 1
|
local _PALETTE_HEX = 1
|
||||||
local _TYPE_STRING = 'string'
|
local _TYPE_STRING = 'string'
|
||||||
local _TYPE_TABLE = 'table'
|
local _TYPE_TABLE = 'table'
|
||||||
|
|
||||||
-- Determine which set of colors to use.
|
-- Determine which set of colors to use.
|
||||||
local _USE_HEX = vim.o.termguicolors
|
local _USE_HEX = go.termguicolors
|
||||||
local _USE_256 = tonumber(vim.o.t_Co) > 255
|
local _USE_256 = tonumber(go.t_Co) > 255
|
||||||
or string.find(vim.env.TERM, '256')
|
or string.find(vim.env.TERM, '256')
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
@ -88,7 +89,7 @@ local function tohex(rgb) return string.format('#%06x', rgb) end
|
||||||
-- Load specific &bg instructions
|
-- Load specific &bg instructions
|
||||||
local function use_background_with(attributes)
|
local function use_background_with(attributes)
|
||||||
return setmetatable(
|
return setmetatable(
|
||||||
attributes[vim.o.background],
|
attributes[go.background],
|
||||||
{['__index'] = attributes}
|
{['__index'] = attributes}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -102,7 +103,7 @@ end
|
||||||
local yolokai = {}
|
local yolokai = {}
|
||||||
|
|
||||||
function yolokai.group(group_name)
|
function yolokai.group(group_name)
|
||||||
local no_errors, group_definition = pcall(api.nvim_get_hl_by_name, group_name, vim.o.termguicolors)
|
local no_errors, group_definition = pcall(api.nvim_get_hl_by_name, group_name, go.termguicolors)
|
||||||
|
|
||||||
if not no_errors then group_definition = {} end
|
if not no_errors then group_definition = {} end
|
||||||
|
|
||||||
|
@ -132,7 +133,7 @@ function yolokai.highlight(highlight_group, attributes) -- {{{ †
|
||||||
highlight_cmd[5] = attributes
|
highlight_cmd[5] = attributes
|
||||||
else -- The `highlight_group` is uniquely defined.
|
else -- The `highlight_group` is uniquely defined.
|
||||||
-- Take care of special instructions for certain background colors.
|
-- Take care of special instructions for certain background colors.
|
||||||
if attributes[vim.o.background] then
|
if attributes[go.background] then
|
||||||
attributes = use_background_with(attributes)
|
attributes = use_background_with(attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -154,7 +155,7 @@ end --}}} ‡
|
||||||
|
|
||||||
function yolokai:highlight_terminal(terminal_ansi_colors)
|
function yolokai:highlight_terminal(terminal_ansi_colors)
|
||||||
for index, color in ipairs(terminal_ansi_colors) do vim.g['terminal_color_'..(index-1)] =
|
for index, color in ipairs(terminal_ansi_colors) do vim.g['terminal_color_'..(index-1)] =
|
||||||
vim.o.termguicolors and color[_PALETTE_HEX] or color[_PALETTE_256] or get(color, _PALETTE_ANSI)
|
go.termguicolors and color[_PALETTE_HEX] or color[_PALETTE_256] or get(color, _PALETTE_ANSI)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -186,7 +187,7 @@ return setmetatable(yolokai, {['__call'] = function(self, normal, highlights, te
|
||||||
color_name = nil
|
color_name = nil
|
||||||
|
|
||||||
-- If we aren't using hex nor 256 colorsets.
|
-- If we aren't using hex nor 256 colorsets.
|
||||||
if not (_USE_HEX or _USE_256) then vim.o.t_Co = '16' end
|
if not (_USE_HEX or _USE_256) then go.t_Co = '16' end
|
||||||
|
|
||||||
-- Highlight the baseline.
|
-- Highlight the baseline.
|
||||||
self.highlight('Normal', normal)
|
self.highlight('Normal', normal)
|
||||||
|
|
Loading…
Reference in a new issue