2023-09-06 17:52:42 +00: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())
|
|
|
|
|
|
|
|
lsp.setup()
|
2023-09-13 09:41:56 +00:00
|
|
|
|
|
|
|
local cmp = require('cmp')
|
|
|
|
local cmp_action = require('lsp-zero').cmp_action()
|
|
|
|
|
|
|
|
cmp.setup({
|
|
|
|
mapping = {
|
|
|
|
-- `Enter` key to confirm completion
|
|
|
|
['<CR>'] = cmp.mapping.confirm({select = false}),
|
|
|
|
|
|
|
|
-- 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(),
|
|
|
|
}
|
|
|
|
})
|