]> src.twobees.de Git - dotfiles.git/blobdiff - stow/nvim/.config/nvim/lua/lspsetup.lua
...
[dotfiles.git] / stow / nvim / .config / nvim / lua / lspsetup.lua
index 2701515ec7719b3b8cc6b442fffdca127a4688bb..170bfebfafe6024675e8c6942643295ebfd85166 100644 (file)
@@ -1,52 +1,21 @@
-vim.api.nvim_create_autocmd('LspAttach', {
-    callback = function()
-        vim.keymap.set ("n", "K", vim.lsp.buf.hover, { buffer=0}) -- buffer=0 -> only in current buffer
-        vim.keymap.set ("n", "gd", vim.lsp.buf.definition, { buffer=0}) -- goto definition
-        vim.keymap.set ("n", "gT", vim.lsp.buf.type_definition, { buffer=0}) -- goto typedefinition
-        vim.keymap.set ("n", "gi", vim.lsp.buf.implementation, { buffer=0}) -- goto implementation
-        vim.keymap.set ("n", "dj", vim.diagnostic.goto_next, { buffer=0}) -- goto dignostic next
-        vim.keymap.set ("n", "dk", vim.diagnostic.goto_prev, { buffer=0}) -- goto diognostic prev
-        vim.keymap.set ("n", "dl", "<cmd>Telescope diagnostic", { buffer=0}) -- goto list failure
-        vim.keymap.set ("n", "<leader>r", vim.lsp.buf.rename, { buffer=0})
-    end,
-})
-require("mason").setup()
-
-require'lspconfig'.csharp_ls.setup({})
+local lsp = require('lsp-zero')
 
-require'lspconfig'.perlls.setup{
-    settings = {
-        perl = {
-            fileFilter = { ".pm", ".pl" },
-            ignoreDirs = ".git",
-            perlCmd = "perl",
-            perlInc = " "
-        }
-    },
-    single_file_support = true
-}
-
-
-require'lspconfig'.sumneko_lua.setup {
-    filetypes = { "lua"},
+lsp.preset('recommended')
+lsp.configure('sumneko_lua', {
     settings = {
         Lua = {
-            runtime = {
-                -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
-                version = 'LuaJIT',
-            },
             diagnostics = {
-                -- Get the language server to recognize the `vim` global
-                globals = {'vim'},
-            },
-            workspace = {
-                -- Make the server aware of Neovim runtime files
-                library = vim.api.nvim_get_runtime_file("", true),
-            },
-            -- Do not send telemetry data containing a randomized but unique identifier
-            telemetry = {
-                enable = false,
-            },
-        },
-    },
-}
+                globals = { 'vim' }
+            }
+        }
+    }
+})
+lsp.setup()
+
+vim.lsp.handlers["textDocument/publishDiagnostics"] =
+vim.lsp.with(
+    vim.lsp.diagnostic.on_publish_diagnostics,
+    {
+        virtual_text = true, -- inline diagnostic on line end
+    }
+)