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', csNewType = 'Type',
csParens = 'Delimiter', csParens = 'Delimiter',
csPreCondit = 'PreProc', csPreCondit = 'PreProc',
csQuote = 'Delimiter',
csRepeat = 'Repeat', csRepeat = 'Repeat',
csStorage = 'StorageClass', csStorage = 'StorageClass',
csUnspecifiedStatement = 'Statement', csUnspecifiedStatement = 'Statement',
csXmlTag = 'Define', csXmlTag = 'Define',
csXmlTagName = '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 ]]
cssAtRule = 'PreCondit',
cssAttr = 'Keyword',
cssAttrComma = 'Noise',
cssAttrRegion = 'Keyword',
cssBraces = 'Delimiter', cssBraces = 'Delimiter',
cssProp = 'Keyword' , cssClassName = 'Identifier',
cssClassNameDot = 'Noise',
cssFlexibleBoxAttr = 'cssAttr',
cssFunctionComma = 'Noise',
cssImportant = 'Exception',
cssNoise = 'Noise',
cssProp = 'Label',
cssPseudoClass = 'Special',
cssPseudoClassId = 'cssSelectorOp',
cssSelectorOp = 'Operator', cssSelectorOp = 'Operator',
cssTagName = 'Type' , cssTagName = 'Structure',
cssTagName = 'htmlTagName', cssUnitDecorators = 'Type',
scssAmpersand = 'Special', scssAmpersand = 'Special',
scssAttribute = 'Normal' , scssAttribute = 'Noise',
scssBoolean = 'Boolean', scssBoolean = 'Boolean',
scssDefault = 'Keyword', 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', scssIf = 'PreCondit',
scssInclude = 'Include', scssInclude = 'Include',
scssSelectorChar = 'Operator' , scssSelectorChar = 'Delimiter',
scssSelectorName = 'Label' , scssDefinition = 'PreProc',
scssSelectorName = 'Identifier',
scssVariable = 'Define', scssVariable = 'Define',
scssVariableAssignment = 'Operator', scssVariableAssignment = 'Operator',
@ -465,11 +500,16 @@ local highlight_groups = {
luaFuncName = 'Function', luaFuncName = 'Function',
luaFuncParens = 'Delimiter', luaFuncParens = 'Delimiter',
luaFuncTable = 'Structure', luaFuncTable = 'Structure',
luaIn = 'luaRepeat',
luaLocal = 'Type', luaLocal = 'Type',
luaNoise = 'Delimiter', luaNoise = 'Delimiter',
luaParens = 'Delimiter', luaParens = 'Delimiter',
luaSpecialTable = 'StorageClass', luaSpecialTable = 'Structure',
luaSpecialValue = 'Function', 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',

View file

@ -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
--[[ --[[
/* /*
@ -26,8 +27,8 @@ 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)