trixy/lua/plugins/lsp-zero.lua

68 lines
1.5 KiB
Lua
Raw Normal View History

2023-07-29 15:00:35 +02:00
local lsp = require('lsp-zero').preset({})
lsp.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp.default_keymaps({buffer = bufnr})
end)
-- (Optional) Configure lua language server for neovim
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
2024-02-04 00:25:41 +01:00
require'lspconfig'.pylsp.setup{
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = {'W391', 'E303', 'E226'},
maxLineLength = 120
}
}
}
}
}
2023-07-29 15:00:35 +02:00
2024-02-04 00:25:41 +01:00
lsp.setup()
2023-07-29 15:00:35 +02:00
-- You need to setup `cmp` after lsp-zero
local cmp = require('cmp')
local cmp_action = require('lsp-zero').cmp_action()
2024-02-04 00:25:41 +01:00
2023-07-29 15:00:35 +02:00
cmp.setup({
mapping = {
-- `Enter` key to confirm completion
['<CR>'] = cmp.mapping.confirm({select = true}),
-- Cycle with tab, as intended by divine creation
2023-07-29 15:00:35 +02:00
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, {"i", "s"}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, {"i", "s"}),
-- Ctrl+Space to trigger completion menu
['<C-Space>'] = cmp.mapping.complete(),
-- Navigate between snippet placeholder
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = cmp_action.luasnip_jump_backward(),
}
})