From 80e0507df2411a0e6188f9e9c1dbb75eb6ec3fae Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Thu, 7 Nov 2024 01:58:17 -0500 Subject: [PATCH] link lua func --- .config/nvim/lua/link-hl.lua | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .config/nvim/lua/link-hl.lua diff --git a/.config/nvim/lua/link-hl.lua b/.config/nvim/lua/link-hl.lua new file mode 100644 index 00000000..562d8d17 --- /dev/null +++ b/.config/nvim/lua/link-hl.lua @@ -0,0 +1,59 @@ +local M = {} + +-- test comment + +M.go_map = { + -- ["@lsp.type.class"] = { link = "Structure" }, + -- ["@lsp.type.decorator"] = { link = "Function" }, + -- ["@lsp.type.enum"] = { link = "Structure" }, + -- ["@lsp.type.enumMember"] = { link = "Constant" }, + -- ["@lsp.type.function"] = { link = "Function" }, + -- ["@lsp.type.interface"] = { link = "Structure" }, + ["@lsp.type.macro"] = "Macro", + ["@lsp.type.method"] = "@function.method", -- Function + ["@lsp.type.namespace"] = "@module", -- Structure + ["@lsp.type.parameter"] = "@variable.parameter", -- Identifier + -- ["@lsp.type.property"] = { link = "Identifier" }, + -- ["@lsp.type.struct"] = { link = "Structure" }, + -- ["@lsp.type.type"] = { link = "Type" }, + -- ["@lsp.type.typeParameter"] = { link = "TypeDef" }, + ["@lsp.type.variable"] = "@variable", -- Identifier + ["@lsp.type.comment"] = "@comment", -- Comment + ["@lsp.type.type"] = "gotype", + + ["@lsp.type.selfParameter"] = "@variable.builtin", + -- ["@lsp.type.builtinConstant"] = { link = "@constant.builtin" }, + ["@lsp.type.builtinConstant"] = "@constant.builtin", + ["@lsp.type.magicFunction"] = "@function.builtin", + + ["@lsp.mod.readonly"] = "Constant", + ["@lsp.mod.typeHint"] = "Type", + -- ["@lsp.mod.defaultLibrary"] = { link = "Special" }, + -- ["@lsp.mod.builtin"] = { link = "Special" }, + + ["@lsp.typemod.operator.controlFlow"] = "@keyword.exception", + ["@lsp.typemod.keyword.documentation"] = "Special", + + ["@lsp.typemod.variable.global"] = "Constant", + ["@lsp.typemod.variable.static"] = "Constant", + ["@lsp.typemod.variable.defaultLibrary"] = "Special", + + ["@lsp.typemod.function.builtin"] = "@function.builtin", + ["@lsp.typemod.function.defaultLibrary"] = "@function.builtin", + ["@lsp.typemod.method.defaultLibrary"] = "@function.builtin", + + ["@lsp.typemod.operator.injected"] = "Operator", + ["@lsp.typemod.string.injected"] = "String", + ["@lsp.typemod.variable.injected"] = "@variable", + + -- ["@lsp.typemod.function.readonly"] = { fg = theme.syn.fun, bold = true }, +} + +function M.link(table, lang) + for hl, input in pairs(table) do + local l = input .. "." .. lang + vim.api.nvim_set_hl(0, hl, { link = l }) + end +end + +return M