nvim: Sync with changes to nvim-highlite upstream
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
57b888e2dd
commit
5b4ed5f9c6
2 changed files with 106 additions and 48 deletions
|
@ -1,7 +1,7 @@
|
||||||
lua << EOF
|
lua << EOF
|
||||||
--[[ Build using Highlite, a Neovim colorscheme template.
|
--[[ Build using Highlite, a Neovim colorscheme template.
|
||||||
* Author: Iron-E (https://github.com/Iron-E)
|
* Author: Iron-E (https://github.com/Iron-E)
|
||||||
* Repository: https://github.com/nvim-highlite
|
* Repository: https://github.com/Iron-E/nvim-highlite
|
||||||
|
|
||||||
Rewrite of RNB, a Vim colorsheme template.
|
Rewrite of RNB, a Vim colorsheme template.
|
||||||
* Author: Romain Lafourcade (https://github.com/romainl)
|
* Author: Romain Lafourcade (https://github.com/romainl)
|
||||||
|
@ -79,6 +79,7 @@ local highlight_groups = {
|
||||||
Operator = {bg=NONE, fg=pink, style=NONE },
|
Operator = {bg=NONE, fg=pink, style=NONE },
|
||||||
Keyword = {bg=NONE, fg=pink, style='bold' },
|
Keyword = {bg=NONE, fg=pink, style='bold' },
|
||||||
Exception = {bg=NONE, fg=red, style='bold' },
|
Exception = {bg=NONE, fg=red, style='bold' },
|
||||||
|
Noise = 'Delimiter',
|
||||||
|
|
||||||
--[[ 4.1.4. Metatextual Information]]
|
--[[ 4.1.4. Metatextual Information]]
|
||||||
PreProc = {bg=NONE, fg=green, style=NONE },
|
PreProc = {bg=NONE, fg=green, style=NONE },
|
||||||
|
@ -221,11 +222,40 @@ local highlight_groups = {
|
||||||
cppSTLnamespace = {link='String' },
|
cppSTLnamespace = {link='String' },
|
||||||
|
|
||||||
--[[ 4.3.3 C# ]]
|
--[[ 4.3.3 C# ]]
|
||||||
csLogicSymbols = {link='Operator'},
|
csBraces = 'Delimiter',
|
||||||
|
csClass = 'Structure',
|
||||||
|
csClassType = 'Type',
|
||||||
|
csContextualStatement = 'Conditional',
|
||||||
|
csEndColon = 'Delimiter',
|
||||||
|
csLogicSymbols = 'Operator',
|
||||||
|
csModifier = 'Keyword',
|
||||||
|
csNew = 'Operator',
|
||||||
|
csNewType = 'Type',
|
||||||
|
csParens = 'Delimiter',
|
||||||
|
csPreCondit = 'PreProc',
|
||||||
|
csRepeat = 'Repeat',
|
||||||
|
csStorage = 'StorageClass',
|
||||||
|
csUnspecifiedStatement = 'Statement',
|
||||||
|
csXmlTag = 'Define',
|
||||||
|
csXmlTagName = 'Define',
|
||||||
|
|
||||||
--[[ 4.3.4. CSS ]]
|
--[[ 4.3.4. CSS ]]
|
||||||
cssProp = {link='Keyword'},
|
cssBraces = 'Delimiter',
|
||||||
cssTagName = {link='Type' },
|
cssProp = 'Keyword',
|
||||||
|
cssSelectorOp = 'Operator',
|
||||||
|
cssTagName = 'Type',
|
||||||
|
cssTagName = 'htmlTagName',
|
||||||
|
scssAmpersand = 'Special',
|
||||||
|
scssAttribute = 'Normal',
|
||||||
|
scssBoolean = 'Boolean',
|
||||||
|
scssDefault = 'Keyword',
|
||||||
|
scssElse = 'PreCondit',
|
||||||
|
scssIf = 'PreCondit',
|
||||||
|
scssInclude = 'Include',
|
||||||
|
scssSelectorChar = 'Operator',
|
||||||
|
scssSelectorName = 'Label',
|
||||||
|
scssVariable = 'Define',
|
||||||
|
scssVariableAssignment = 'Operator',
|
||||||
|
|
||||||
--[[ 4.3.5. Dart ]]
|
--[[ 4.3.5. Dart ]]
|
||||||
dartLibrary = {link='Statement'},
|
dartLibrary = {link='Statement'},
|
||||||
|
@ -258,9 +288,21 @@ local highlight_groups = {
|
||||||
goVarDefs = {link='goVarAssign' },
|
goVarDefs = {link='goVarAssign' },
|
||||||
|
|
||||||
--[[ 4.3.8. HTML ]]
|
--[[ 4.3.8. HTML ]]
|
||||||
htmlBold = {bg=NONE, fg=NONE, style='bold' },
|
htmlArg = 'Label',
|
||||||
|
htmlBold = {bg=NONE, fg=lightgrey, style='bold'},
|
||||||
|
htmlTitle = 'htmlBold',
|
||||||
|
htmlEndTag = 'htmlTag',
|
||||||
|
htmlH1 = 'markdownH1',
|
||||||
|
htmlH2 = 'markdownH2',
|
||||||
|
htmlH3 = 'markdownH3',
|
||||||
|
htmlH4 = 'markdownH4',
|
||||||
|
htmlH5 = 'markdownH5',
|
||||||
|
htmlH6 = 'markdownH6',
|
||||||
htmlItalic = {bg=NONE, fg=NONE, style='italic'},
|
htmlItalic = {bg=NONE, fg=NONE, style='italic'},
|
||||||
htmlSpecialTagName = {link='Tag' },
|
htmlSpecialTagName = 'Keyword',
|
||||||
|
htmlTag = 'Special',
|
||||||
|
htmlTagN = 'Typedef',
|
||||||
|
htmlTagName = 'Type',
|
||||||
|
|
||||||
--[[ 4.3.9. Java ]]
|
--[[ 4.3.9. Java ]]
|
||||||
javaClassDecl = {link='Structure'},
|
javaClassDecl = {link='Structure'},
|
||||||
|
@ -272,7 +314,12 @@ local highlight_groups = {
|
||||||
jsVariableDef = {link='Identifier'},
|
jsVariableDef = {link='Identifier'},
|
||||||
|
|
||||||
--[[ 4.3.11. JSON ]]
|
--[[ 4.3.11. JSON ]]
|
||||||
jsonStringSQError = {link='Exception'},
|
jsonBraces = 'luaBraces',
|
||||||
|
jsonKeywordMatch = 'Delimiter',
|
||||||
|
jsonNull = 'Constant',
|
||||||
|
jsonQuote = 'String',
|
||||||
|
jsonString = 'Normal',
|
||||||
|
jsonStringSQError = 'Exception',
|
||||||
|
|
||||||
--[[ 4.3.12. Make ]]
|
--[[ 4.3.12. Make ]]
|
||||||
makeCommands = {link='Statment'},
|
makeCommands = {link='Statment'},
|
||||||
|
@ -370,6 +417,23 @@ local highlight_groups = {
|
||||||
haskellImportKeywords = {link='Include' },
|
haskellImportKeywords = {link='Include' },
|
||||||
haskellStatement = {link='Statement' },
|
haskellStatement = {link='Statement' },
|
||||||
|
|
||||||
|
--[[ 4.3.30 Lua ]]
|
||||||
|
luaBraces = 'Structure',
|
||||||
|
luaBrackets = 'Delimiter',
|
||||||
|
luaBuiltin = 'Keyword',
|
||||||
|
luaComma = 'Delimiter',
|
||||||
|
luaFuncCall = 'Function',
|
||||||
|
luaFuncId = 'luaNoise',
|
||||||
|
luaFuncKeyword = 'Function',
|
||||||
|
luaFuncName = 'Identifier',
|
||||||
|
luaFuncParens = 'Delimiter',
|
||||||
|
luaFuncTable = 'Structure',
|
||||||
|
luaLocal = 'Type',
|
||||||
|
luaNoise = 'Operator',
|
||||||
|
luaParens = 'Delimiter',
|
||||||
|
luaSpecialTable = 'Identifier',
|
||||||
|
luaSpecialValue = 'Function',
|
||||||
|
|
||||||
--[[ 4.4. Plugins
|
--[[ 4.4. Plugins
|
||||||
Everything in this section is OPTIONAL. Feel free to remove everything
|
Everything in this section is OPTIONAL. Feel free to remove everything
|
||||||
here if you don't want to define it, or add more if there's something
|
here if you don't want to define it, or add more if there's something
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
--[[ NOTHING INSIDE THIS FILE NEEDS TO BE EDITED BY THE USER. ]]
|
--[[ NOTHING INSIDE THIS FILE NEEDS TO BE EDITED BY THE USER. ]]
|
||||||
|
local vim = vim
|
||||||
|
|
||||||
-- Clear the highlighting.
|
-- Clear the highlighting.
|
||||||
vim.cmd('hi clear')
|
vim.cmd('hi clear')
|
||||||
|
@ -36,55 +37,48 @@ local function get(color, index)
|
||||||
end
|
end
|
||||||
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
|
||||||
|
|
||||||
|
-- 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
|
||||||
|
end
|
||||||
|
|
||||||
-- Generate a `:highlight` command from a group and some attributes.
|
-- Generate a `:highlight` command from a group and some attributes.
|
||||||
local function highlight(highlight_group, attributes) -- {{{ †
|
local function highlight(highlight_group, attributes) -- {{{ †
|
||||||
local highlight_cmd = {'hi! ', highlight_group}
|
local highlight_cmd = {'hi! ', highlight_group}
|
||||||
local link = attributes.link
|
local link = (type(attributes) == 'string' and attributes)
|
||||||
|
or attributes.link
|
||||||
|
|
||||||
-- If the `highlight_group` is a link to another group.
|
if link then -- `highlight_group` is a link to another group.
|
||||||
if attributes.link then
|
highlight_cmd[3] = highlight_cmd[2]..' '
|
||||||
highlight_cmd[3] = highlight_cmd[2] .. ' '
|
|
||||||
highlight_cmd[2] = 'link '
|
highlight_cmd[2] = 'link '
|
||||||
highlight_cmd[4] = attributes.link
|
highlight_cmd[4] = link
|
||||||
else -- the `highlight_group` is uniquely defined.
|
else -- the `highlight_group` is uniquely defined.
|
||||||
local bg = attributes.bg
|
colorize(highlight_cmd, attributes)
|
||||||
local fg = attributes.fg
|
|
||||||
local style = attributes.style
|
local style = attributes.style
|
||||||
|
|
||||||
-- If using hex and 256-bit colors, then populate the gui* and cterm* args.
|
|
||||||
if use_hex_and_256 then highlight_cmd[#highlight_cmd + 1] =
|
|
||||||
' ctermbg=' .. get(bg, BIT_256)
|
|
||||||
.. ' ctermfg=' .. get(fg, BIT_256)
|
|
||||||
.. ' guibg=' .. get(bg, HEX)
|
|
||||||
.. ' guifg=' .. get(fg, HEX)
|
|
||||||
-- If using 16-bit colors, just populate the cterm* args.
|
|
||||||
else highlight_cmd[#highlight_cmd + 1] =
|
|
||||||
' ctermbg=' .. get(bg, BIT_16)
|
|
||||||
.. ' ctermfg=' .. get(fg, BIT_16)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This function appends `selected_attributes` to the end of the `highlight_cmd`.
|
|
||||||
local function append_style(selected_attributes)
|
|
||||||
highlight_cmd[#highlight_cmd + 1] = ' cterm=' .. selected_attributes
|
|
||||||
|
|
||||||
-- If we're using hex populate the gui* attr args.
|
|
||||||
if use_hex_and_256 then highlight_cmd[#highlight_cmd + 1] =
|
|
||||||
' gui=' .. selected_attributes
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if type(style) == 'table' then
|
if type(style) == 'table' then
|
||||||
-- Concat all of the entries together with a comma between.
|
-- Concat all of the entries together with a comma between before styling.
|
||||||
local style_all = table.concat(style, ',')
|
stylize(highlight_cmd, table.concat(style, ','))
|
||||||
|
|
||||||
-- There will always be a cterm attr arg.
|
if style.color then -- there won't is a color for undercurl.
|
||||||
append_style(style_all)
|
highlight_cmd[#highlight_cmd + 1] = ' guisp='..get(style.color, HEX)
|
||||||
|
|
||||||
-- There won't always be a `guisp`.
|
|
||||||
if style.color then highlight_cmd[#highlight_cmd + 1] =
|
|
||||||
' guisp=' .. get(style.color, HEX)
|
|
||||||
end
|
end
|
||||||
else append_style(style)
|
else -- just style the single entry.
|
||||||
|
stylize(highlight_cmd, style)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,6 +96,6 @@ return function(Normal, highlights, terminal_ansi_colors)
|
||||||
|
|
||||||
-- Set the terminal colors.
|
-- Set the terminal colors.
|
||||||
for index, color in ipairs(terminal_ansi_colors) do
|
for index, color in ipairs(terminal_ansi_colors) do
|
||||||
vim.g['terminal_color_' .. index] = get(color, HEX)
|
vim.g['terminal_color_'..index] = color[HEX] or color[BIT_256] or color[BIT_16]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue