70 lines
1.7 KiB
Lua
70 lines
1.7 KiB
Lua
local nvim_lsp = require'lspconfig'
|
|
|
|
local function setup_servers()
|
|
require'lspinstall'.setup()
|
|
local servers = require'lspinstall'.installed_servers()
|
|
for _, lsp in pairs(servers) do
|
|
nvim_lsp[lsp].setup{}
|
|
end
|
|
end
|
|
|
|
local opts = {
|
|
tools = {
|
|
autoSetHints = true,
|
|
hover_with_actions = true,
|
|
runnables = {
|
|
use_telescope = true
|
|
},
|
|
inlay_hints = {
|
|
show_parameter_hints = false,
|
|
parameter_hints_prefix = "",
|
|
other_hints_prefix = "",
|
|
},
|
|
},
|
|
|
|
-- all the opts to send to nvim-lspconfig
|
|
-- these override the defaults set by rust-tools.nvim
|
|
-- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
|
|
server = {}, -- rust-analyer options
|
|
}
|
|
|
|
require('rust-tools').setup(opts)
|
|
|
|
setup_servers()
|
|
|
|
require'lspinstall'.post_install_hook = function ()
|
|
setup_servers()
|
|
vim.cmd("bufdo e")
|
|
end
|
|
|
|
local cmp = require'cmp'
|
|
cmp.setup({
|
|
snippet = {
|
|
expand = function(args)
|
|
vim.fn["vsnip#anonymous"](args.body)
|
|
end,
|
|
},
|
|
mapping = {
|
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
|
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
|
['<Tab>'] = cmp.mapping.select_next_item(),
|
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
['<C-e>'] = cmp.mapping.close(),
|
|
['<CR>'] = cmp.mapping.confirm({
|
|
behavior = cmp.ConfirmBehavior.Insert,
|
|
select = true,
|
|
})
|
|
},
|
|
|
|
-- Installed sources
|
|
sources = {
|
|
{ name = 'nvim_lsp' },
|
|
{ name = 'vsnip' },
|
|
{ name = 'path' },
|
|
{ name = 'buffer' },
|
|
},
|
|
})
|