1
0
Fork 0

neovim: fix treesitter

This commit is contained in:
Vladimír Dudr 2022-10-17 13:51:24 +02:00
parent 5228c81e6c
commit e6cd9d7272
3 changed files with 132 additions and 16 deletions

View file

@ -39,21 +39,7 @@ vim.cmd [[
-- }}}
-- color handling {{{
local term = vim.env.TERM
if (term ~= 'linux' or vim.g.neoray)
then
vim.cmd('set termguicolors')
vim.g.gruvbox_contrast_dark = 'hard'
vim.cmd('colorscheme gruvbox')
vim.cmd 'highlight link Directory GruvboxGreen'
vim.cmd 'highlight link Function GruvboxFg1'
vim.cmd 'highlight link Operator GruvboxFg1'
end
vim.cmd 'highlight link TSVariable Identifier'
vim.cmd 'highlight link TSVariableBuiltin Identifier'
require("configs.colors")
-- }}}

View file

@ -0,0 +1,130 @@
local hl = function(group, opts)
if (opts.default == nil) then
opts.default = true
end
vim.api.nvim_set_hl(0, group, opts)
end
local function normalizeTSHighlight()
-- Misc {{{
hl('@comment', { link = 'Comment' })
-- hl('@error', {link = 'Error'})
hl('@none', { bg = 'NONE', fg = 'NONE' })
hl('@preproc', { link = 'PreProc' })
hl('@define', { link = 'Define' })
hl('@operator', { link = 'Operator' })
-- }}}
-- Punctuation {{{
hl('@punctuation.delimiter', { link = 'Delimiter' })
hl('@punctuation.bracket', { link = 'Delimiter' })
hl('@punctuation.special', { link = 'Delimiter' })
-- }}}
-- Literals {{{
hl('@string', { link = 'String' })
hl('@string.regex', { link = 'String' })
hl('@string.escape', { link = 'SpecialChar' })
hl('@string.special', { link = 'SpecialChar' })
hl('@character', { link = 'Character' })
hl('@character.special', { link = 'SpecialChar' })
hl('@boolean', { link = 'Boolean' })
hl('@number', { link = 'Number' })
hl('@float', { link = 'Float' })
-- }}}
-- Functions {{{
hl('@function', { link = 'Function' })
hl('@function.call', { link = 'Function' })
hl('@function.builtin', { link = 'Special' })
hl('@function.macro', { link = 'Macro' })
hl('@method', { link = 'Function' })
hl('@method.call', { link = 'Function' })
hl('@constructor', { link = 'Special' })
hl('@parameter', { link = 'Identifier' })
-- }}}
-- Keywords {{{
hl('@keyword', { link = 'Keyword' })
hl('@keyword.function', { link = 'Keyword' })
hl('@keyword.operator', { link = 'Keyword' })
hl('@keyword.return', { link = 'Keyword' })
hl('@conditional', { link = 'Conditional' })
hl('@repeat', { link = 'Repeat' })
hl('@debug', { link = 'Debug' })
hl('@label', { link = 'Label' })
hl('@include', { link = 'Include' })
hl('@exception', { link = 'Exception' })
-- }}}
-- Types {{{
hl('@type', { link = 'Type' })
hl('@type.builtin', { link = 'Type' })
hl('@type.qualifier', { link = 'Type' })
hl('@type.definition', { link = 'Typedef' })
hl('@storageclass', { link = 'StorageClass' })
hl('@attribute', { link = 'PreProc' })
hl('@field', { link = 'Identifier' })
hl('@property', { link = 'Identifier' })
-- }}}
-- Identifiers {{{
hl('@variable', { link = 'Identifier' })
hl('@variable.builtin', { link = 'Identifier' })
hl('@constant', { link = 'Constant' })
hl('@constant.builtin', { link = 'Special' })
hl('@constant.macro', { link = 'Define' })
hl('@namespace', { link = 'Include' })
hl('@symbol', { link = 'Identifier' })
-- }}}
-- Text {{{
hl('@text', { link = 'Normal' })
hl('@text.strong', { bold = true })
hl('@text.emphasis', { italic = true })
hl('@text.underline', { underline = true })
hl('@text.strike', { strikethrough = true })
hl('@text.title', { link = 'Title' })
hl('@text.literal', { link = 'String' })
hl('@text.uri', { link = 'Underlined' })
hl('@text.math', { link = 'Special' })
hl('@text.environment', { link = 'Macro' })
hl('@text.environment.name', { link = 'Type' })
hl('@text.reference', { link = 'Constant' })
hl('@text.todo', { link = 'Todo' })
hl('@text.note', { link = 'SpecialComment' })
hl('@text.warning', { link = 'WarningMsg' })
hl('@text.danger', { link = 'ErrorMsg' })
-- }}}
-- Tags {{{
hl('@tag', { link = 'Tag' })
hl('@tag.attribute', { link = 'Identifier' })
hl('@tag.delimiter', { link = 'Delimiter' })
-- }}}
end
local function customLinks()
hl('Function', { link = 'Normal', default = false })
hl('Operator', { link = 'Normal', default = false })
end
vim.api.nvim_create_autocmd('Colorscheme',
{ pattern = "*", callback = function() normalizeTSHighlight(); customLinks(); end }
)
vim.api.nvim_create_autocmd('Colorscheme', {
pattern = "gruvbox",
callback = function()
hl('Directory', { link = 'GruvboxGreen', default = false })
end
})
local term = vim.env.TERM
if (term ~= 'linux' or vim.g.neoray)
then
vim.cmd('set termguicolors')
vim.g.gruvbox_contrast_dark = 'hard'
vim.cmd('colorscheme gruvbox')
end

View file

@ -20,7 +20,7 @@ function M.setup()
vim.o.shiftwidth = 4
vim.o.number = true
--vim.o.colorcolumn=0
--vim.o.foldmethod='marker'
vim.o.foldmethod='marker'
vim.o.foldcolumn = 'auto:1'
vim.o.signcolumn = 'yes'
vim.o.list = false