From 5f02842084aaeb2b85922bb6f782a464e8c5ad75 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 22 Mar 2023 07:57:25 +0100 Subject: [PATCH] Refactor vim LSP configuration --- vim/lua/on_lsp_attach.lua | 4 ++-- vim/lua/sumneko.lua | 4 ---- vim/plugin/lsp.vim | 2 ++ 3 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 vim/lua/sumneko.lua create mode 100644 vim/plugin/lsp.vim diff --git a/vim/lua/on_lsp_attach.lua b/vim/lua/on_lsp_attach.lua index 7137f91..d5289a6 100644 --- a/vim/lua/on_lsp_attach.lua +++ b/vim/lua/on_lsp_attach.lua @@ -1,6 +1,6 @@ local opts = { noremap=true, silent=true } -return function(client, bufnr) +return function(_, bufnr) -- Enable completion triggered by vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') @@ -23,5 +23,5 @@ return function(client, bufnr) vim.keymap.set('n', 'r', vim.lsp.buf.rename, bufopts) vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'f', vim.lsp.buf.formatting, bufopts) + --vim.keymap.set('n', 'f', vim.lsp.buf.formatting, bufopts) end diff --git a/vim/lua/sumneko.lua b/vim/lua/sumneko.lua deleted file mode 100644 index dfd2ed3..0000000 --- a/vim/lua/sumneko.lua +++ /dev/null @@ -1,4 +0,0 @@ -local lsp_flags = require('lspconfig').sumneko_lua.setup{ - on_attach = require 'on_lsp_attach', -} -vim.api.nvim_command("LspStart") diff --git a/vim/plugin/lsp.vim b/vim/plugin/lsp.vim new file mode 100644 index 0000000..cdb3e42 --- /dev/null +++ b/vim/plugin/lsp.vim @@ -0,0 +1,2 @@ +lua require('lspconfig').lua_ls.setup{ on_attach = require 'on_lsp_attach' } +lua require('lspconfig').zls.setup{ on_attach = require 'on_lsp_attach' }