Refactor vim LSP configuration

This commit is contained in:
Talia 2023-03-22 07:57:25 +01:00
parent 18751c2b5c
commit 5f02842084
3 changed files with 4 additions and 6 deletions

View file

@ -1,6 +1,6 @@
local opts = { noremap=true, silent=true } local opts = { noremap=true, silent=true }
return function(client, bufnr) return function(_, bufnr)
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') 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', '<leader>r', vim.lsp.buf.rename, bufopts) vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<leader>f', vim.lsp.buf.formatting, bufopts) --vim.keymap.set('n', '<leader>f', vim.lsp.buf.formatting, bufopts)
end end

View file

@ -1,4 +0,0 @@
local lsp_flags = require('lspconfig').sumneko_lua.setup{
on_attach = require 'on_lsp_attach',
}
vim.api.nvim_command("LspStart")

2
vim/plugin/lsp.vim Normal file
View file

@ -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' }