setup lsp_installer
This commit is contained in:
parent
27cfca6f21
commit
f3767c2936
2 changed files with 26 additions and 31 deletions
|
@ -27,14 +27,14 @@ cmp.setup({
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
-- Use buffer source for `/`
|
||||||
cmp.setup.cmdline('/', {
|
cmp.setup.cmdline('/', {
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'buffer' }
|
{ name = 'buffer' }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
-- Use cmdline & path source for ':'
|
||||||
cmp.setup.cmdline(':', {
|
cmp.setup.cmdline(':', {
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'path' }
|
{ name = 'path' }
|
||||||
|
@ -43,24 +43,28 @@ cmp.setup.cmdline(':', {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Setup lspconfig.
|
local on_attach = function(client, bufnr)
|
||||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local function buf_set_keymap(...)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
|
end
|
||||||
|
|
||||||
lspconfig = require "lspconfig"
|
local opts = { noremap = true, silent = true }
|
||||||
lspconfig.tsserver.setup{ capabilities = capabilities }
|
buf_set_keymap("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
||||||
lspconfig.intelephense.setup{ capabilities = capabilities }
|
buf_set_keymap("n", "gh", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||||
lspconfig.vuels.setup{ capabilities = capabilities }
|
buf_set_keymap("n", "gD", "<cmd>Telescope lsp_implementations<CR>", opts)
|
||||||
lspconfig.pylsp.setup{ capabilities = capabilities}
|
buf_set_keymap("n", "gs", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
lspconfig.texlab.setup{ capabilities = capabilities }
|
buf_set_keymap("n", "gR", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||||
lspconfig.gopls.setup {
|
buf_set_keymap("n", "gH", "<cmd>Telescope lsp_code_actions()<CR>", opts)
|
||||||
cmd = {"gopls", "serve"},
|
buf_set_keymap("n", "gr", "<cmd>Telescope lsp_references<CR>", opts)
|
||||||
settings = {
|
buf_set_keymap("n", "ge", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
||||||
gopls = {
|
end
|
||||||
analyses = {
|
|
||||||
unusedparams = true,
|
local lsp_installer = require "nvim-lsp-installer"
|
||||||
},
|
lsp_installer.on_server_ready(function(server)
|
||||||
staticcheck = true,
|
local opts = {}
|
||||||
},
|
opts.on_attach = on_attach
|
||||||
},
|
opts.capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
capabilities = capabilities
|
|
||||||
}
|
server:setup(opts)
|
||||||
|
vim.cmd [[ do User LspAttachBuffers ]]
|
||||||
|
end)
|
||||||
|
|
|
@ -42,10 +42,6 @@ map {'n', '<leader>e', ':NvimTreeToggle<CR>'}
|
||||||
map {'n', '<C-y>', '<cmd>Telescope buffers<CR>'}
|
map {'n', '<C-y>', '<cmd>Telescope buffers<CR>'}
|
||||||
map {'n', '<leader>f', '<cmd>Telescope find_files<CR>'}
|
map {'n', '<leader>f', '<cmd>Telescope find_files<CR>'}
|
||||||
map {'n', '<leader>l', '<cmd>Telescope live_grep<CR>'}
|
map {'n', '<leader>l', '<cmd>Telescope live_grep<CR>'}
|
||||||
map {'n', '<silent> gD', '<cmd>Telescope lsp_implementations<CR>'}
|
|
||||||
map {'n', '<silent> gH', '<cmd>Telescope lsp_code_actions<CR>'}
|
|
||||||
map {'n', '<silent> gd', '<cmd>Telescope lsp_definitions<CR>'}
|
|
||||||
map {'n', '<silent> gr', '<cmd>Telescope lsp_references<CR>'}
|
|
||||||
map {'n', '<silent> gy', '<cmd>Telescope treesitter<CR>'}
|
map {'n', '<silent> gy', '<cmd>Telescope treesitter<CR>'}
|
||||||
|
|
||||||
-- neo formatter
|
-- neo formatter
|
||||||
|
@ -57,8 +53,3 @@ map {'n', '<silent> <leader>w', ':Goyo<CR>'}
|
||||||
-- spelling
|
-- spelling
|
||||||
map {'n', '<silent> <leader>se', ':set spell spelllang=en<CR>'}
|
map {'n', '<silent> <leader>se', ':set spell spelllang=en<CR>'}
|
||||||
map {'n', '<silent> <leader>sd', ':set spell spelllang=de<CR>'}
|
map {'n', '<silent> <leader>sd', ':set spell spelllang=de<CR>'}
|
||||||
|
|
||||||
map {'n', '<silent> gh', '<cmd>lua vim.lsp.buf.hover()<CR>'}
|
|
||||||
map {'n', '<silent> gs', '<cmd>lua vim.lsp.buf.signature_help()<CR>'}
|
|
||||||
map {'n', '<silent> gR', '<cmd>lua vim.lsp.buf.rename()<CR>'}
|
|
||||||
map {'n', '<silent> ge', '<cmd>lua vim.diagnostic.open_float()<CR>'}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue