nvim: yolokai: Sync with nvim-highlite upstream

This commit is contained in:
Sanchayan Maity 2021-06-13 15:32:00 +05:30
parent 0eb9b86927
commit 3d8ccb4f23
2 changed files with 103 additions and 71 deletions

View file

@ -243,27 +243,62 @@ local highlight_groups = {
csNewType = 'Type',
csParens = 'Delimiter',
csPreCondit = 'PreProc',
csQuote = 'Delimiter',
csRepeat = 'Repeat',
csStorage = 'StorageClass',
csUnspecifiedStatement = 'Statement',
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 ]]
cssAtRule = 'PreCondit',
cssAttr = 'Keyword',
cssAttrComma = 'Noise',
cssAttrRegion = 'Keyword',
cssBraces = 'Delimiter',
cssProp = 'Keyword' ,
cssClassName = 'Identifier',
cssClassNameDot = 'Noise',
cssFlexibleBoxAttr = 'cssAttr',
cssFunctionComma = 'Noise',
cssImportant = 'Exception',
cssNoise = 'Noise',
cssProp = 'Label',
cssPseudoClass = 'Special',
cssPseudoClassId = 'cssSelectorOp',
cssSelectorOp = 'Operator',
cssTagName = 'Type' ,
cssTagName = 'htmlTagName',
cssTagName = 'Structure',
cssUnitDecorators = 'Type',
scssAmpersand = 'Special',
scssAttribute = 'Normal' ,
scssAttribute = 'Noise',
scssBoolean = 'Boolean',
scssDefault = 'Keyword',
scssElse = 'PreCondit' ,
scssElse = 'scssIf',
scssMixinName = function(self)
local super = self.cssClassName
return {bg = super.bg, fg=super.fg, style='Italic'}
end,
scssIf = 'PreCondit',
scssInclude = 'Include',
scssSelectorChar = 'Operator' ,
scssSelectorName = 'Label' ,
scssSelectorChar = 'Delimiter',
scssDefinition = 'PreProc',
scssSelectorName = 'Identifier',
scssVariable = 'Define',
scssVariableAssignment = 'Operator',
@ -465,11 +500,16 @@ local highlight_groups = {
luaFuncName = 'Function',
luaFuncParens = 'Delimiter',
luaFuncTable = 'Structure',
luaIn = 'luaRepeat',
luaLocal = 'Type',
luaNoise = 'Delimiter',
luaParens = 'Delimiter',
luaSpecialTable = 'StorageClass',
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 ]]
sqlKeyword = 'Keyword' ,
@ -480,6 +520,7 @@ local highlight_groups = {
--[[ 4.3.26. dos INI ]]
dosiniHeader = 'Title',
dosiniLabel = 'Label',
--[[ 4.3.27. Crontab ]]
crontabDay = 'StorageClass',
@ -542,16 +583,6 @@ local highlight_groups = {
ALEErrorSign = 'ErrorMsg' ,
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 ]]
EasyMotion = 'IncSearch' ,
JumpMotion = 'EasyMotion',

View file

@ -10,6 +10,7 @@ local vim = vim
local api = vim.api
local exe = api.nvim_command
local fn = vim.fn
local go = vim.go
--[[
/*
@ -26,8 +27,8 @@ local _TYPE_STRING = 'string'
local _TYPE_TABLE = 'table'
-- Determine which set of colors to use.
local _USE_HEX = vim.o.termguicolors
local _USE_256 = tonumber(vim.o.t_Co) > 255
local _USE_HEX = go.termguicolors
local _USE_256 = tonumber(go.t_Co) > 255
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
local function use_background_with(attributes)
return setmetatable(
attributes[vim.o.background],
attributes[go.background],
{['__index'] = attributes}
)
end
@ -102,7 +103,7 @@ end
local yolokai = {}
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
@ -132,7 +133,7 @@ function yolokai.highlight(highlight_group, attributes) -- {{{ †
highlight_cmd[5] = attributes
else -- The `highlight_group` is uniquely defined.
-- 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)
end
@ -154,7 +155,7 @@ end --}}} ‡
function yolokai:highlight_terminal(terminal_ansi_colors)
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
@ -186,7 +187,7 @@ return setmetatable(yolokai, {['__call'] = function(self, normal, highlights, te
color_name = nil
-- 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.
self.highlight('Normal', normal)