summaryrefslogtreecommitdiffstats
path: root/plugin/zerolsp.lua
diff options
context:
space:
mode:
authorNanderty <psopka@sopka.ch>2023-03-16 19:34:12 +0100
committerNanderty <psopka@sopka.ch>2023-03-16 19:34:12 +0100
commit423133102d96556d121a97689be1f4f6542e320c (patch)
tree552f25a2ee87542410568f886483cc39e085390c /plugin/zerolsp.lua
parentfba8830826fa88ef43d84fb051f90f11e4ae939b (diff)
downloadneovim-config-423133102d96556d121a97689be1f4f6542e320c.tar.gz
neovim-config-423133102d96556d121a97689be1f4f6542e320c.tar.bz2
neovim-config-423133102d96556d121a97689be1f4f6542e320c.zip
wechsel auf lazy
Diffstat (limited to 'plugin/zerolsp.lua')
-rw-r--r--plugin/zerolsp.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/plugin/zerolsp.lua b/plugin/zerolsp.lua
new file mode 100644
index 0000000..a37bee4
--- /dev/null
+++ b/plugin/zerolsp.lua
@@ -0,0 +1,54 @@
+local lsp = require('lsp-zero').preset({
+ name = 'minimal',
+ set_lsp_keymaps = true,
+ manage_nvim_cmp = true,
+ suggest_lsp_servers = false,
+})
+
+local luasnip = require("luasnip")
+local cmp = require("cmp")
+
+lsp.setup_nvim_cmp({
+ formatting = {
+ fields = {'abbr', 'menu', 'kind'},
+
+ mapping = lsp.defaults.cmp_mappings({
+ ["<Tab>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ elseif luasnip.expand_or_jumpable() then
+ luasnip.expand_or_jump()
+ elseif has_words_before() then
+ cmp.complete()
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+
+ ["<S-Tab>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_prev_item()
+ elseif luasnip.jumpable(-1) then
+ luasnip.jump(-1)
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ }),
+
+ format = function(entry, item)
+ local menu_icon = {
+ nvim_lsp = 'λ',
+ luasnip = '⋗',
+ buffer = 'Ω',
+ path = '🖫',
+ nvim_lua = 'Π',
+ }
+
+ item.menu = menu_icon[entry.source.name]
+ return item
+ end,
+ },
+})
+
+lsp.setup()