Refactor vim LSP configuration
This commit is contained in:
parent
18751c2b5c
commit
5f02842084
3 changed files with 4 additions and 6 deletions
|
@ -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
|
||||||
|
|
|
@ -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
2
vim/plugin/lsp.vim
Normal 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' }
|
Loading…
Reference in a new issue