From a8c1e82095dcbab9eda3d8997c55592808b2a8bd Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Mon, 19 Feb 2024 17:47:25 +0100 Subject: [PATCH] feat(nvim): update color theme with semantic highlighting for go --- nvim/.config/nvim/colors/bsolarized2.lua | 25 ++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/colors/bsolarized2.lua b/nvim/.config/nvim/colors/bsolarized2.lua index b2d88dc..82739f9 100644 --- a/nvim/.config/nvim/colors/bsolarized2.lua +++ b/nvim/.config/nvim/colors/bsolarized2.lua @@ -42,6 +42,10 @@ local table = require('table') +function clear_highlight(name) + vim.api.nvim_set_hl(0, name, {}) +end + function highlight(opts) assert(opts.name, "The name of the group is missing") @@ -127,7 +131,7 @@ vim.cmd [[ endif ]] -vim.g.colors_name = "bsolarized2" +--vim.g.colors_name = "bsolarized2" -- ---------------------------------------------------------------------- -- Builtin groups @@ -339,6 +343,7 @@ highlight {name="Constant", fg=colors.cyan} -- *Identifier any variable name -- Function function name (also: methods for classes) +clear_highlight "Identifier" highlight {name="Identifier", fg=colors.blue} -- *Statement any statement @@ -361,7 +366,7 @@ highlight {name="PreProc", fg=colors.orange} -- StorageClass static, register, volatile, etc. -- Structure struct, union, enum, etc. -- Typedef A typedef -highlight {name="Type", fg=colors.yellow} +highlight {name="Type", fg=colors.yellow, attrs={attrs.bold}} -- *Special any special symbol -- SpecialChar special character in a constant @@ -385,6 +390,22 @@ highlight {name="Error", fg=colors.base03, bg=colors.red, attrs={attrs.bold}} highlight {name="Todo", fg=colors.magenta, bg=colors.none, attrs={attrs.bold}} + +-- ---------------------------------------------------------------------- +-- Semantic tokens +-- ---------------------------------------------------------------------- + +highlight {name = "@lsp.type.namespace", fg=colors.base0 } +highlight {name = "@lsp.type.parameter", fg=colors.magenta } +highlight {name = "@lsp.type.variable", fg=colors.blue, attrs={attrs.italic} } +highlight {name = "@lsp.type.function", fg=colors.blue } +highlight {name = "@lsp.type.method", link="Function" } + +highlight {name = "@lsp.mod.readonly", fg=colors.orange} +highlight {name = "@lsp.mod.definition", attrs={attrs.bold} } +highlight {name = "@lsp.mod.deprecated", attrs={attrs.strike} } + + -- ---------------------------------------------------------------------- -- NvimTree syntax -- ----------------------------------------------------------------------