Update .config/nvim/lua/plugins/lsp.lua
This commit is contained in:
parent
2955066489
commit
d96ca2a454
1 changed files with 59 additions and 53 deletions
|
@ -7,56 +7,62 @@ return {
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
config = function()
|
config = function()
|
||||||
require("lspconfig").gopls.setup {}
|
require("lspconfig").gopls.setup {}
|
||||||
require("lspconfig").lua_ls.setup {}
|
require("lspconfig").lua_ls.setup {}
|
||||||
end
|
end
|
||||||
},
|
|
||||||
{
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
event = "InsertEnter",
|
|
||||||
dependencies = {
|
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
"hrsh7th/cmp-buffer",
|
|
||||||
"hrsh7th/cmp-path",
|
|
||||||
"hrsh7th/cmp-cmdline",
|
|
||||||
"hrsh7th/cmp-vsnip",
|
|
||||||
"hrsh7th/vim-vsnip",
|
|
||||||
"hrsh7th/cmp-nvim-lsp-signature-help"
|
|
||||||
},
|
},
|
||||||
config = function()
|
{
|
||||||
local cmp = require "cmp"
|
"hrsh7th/nvim-cmp",
|
||||||
cmp.setup({
|
event = "InsertEnter",
|
||||||
snippet = {
|
dependencies = {
|
||||||
-- REQUIRED - you must specify a snippet engine
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
expand = function(args)
|
"hrsh7th/cmp-buffer",
|
||||||
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
"hrsh7th/cmp-path",
|
||||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
"hrsh7th/cmp-cmdline",
|
||||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
"hrsh7th/cmp-vsnip",
|
||||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
"hrsh7th/vim-vsnip",
|
||||||
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
"hrsh7th/cmp-nvim-lsp-signature-help"
|
||||||
end,
|
},
|
||||||
},
|
config = function()
|
||||||
mapping = cmp.mapping.preset.insert({
|
local cmp = require "cmp"
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
cmp.setup({
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
snippet = {
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
-- REQUIRED - you must specify a snippet engine
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
expand = function(args)
|
||||||
['<tab>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
}),
|
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
sources = cmp.config.sources({
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||||
{ name = 'nvim_lsp' },
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
{ name = 'vsnip' }, -- For vsnip users.
|
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
||||||
-- { name = 'luasnip' }, -- For luasnip users.
|
end,
|
||||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
},
|
||||||
-- { name = 'snippy' }, -- For snippy users.
|
mapping = cmp.mapping.preset.insert({
|
||||||
}, {
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
{ name = 'buffer' },
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
{ name = 'nvim_lsp_signature_help' }
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
})
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
})
|
['<tab>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
end
|
}),
|
||||||
}
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'vsnip' }, -- For vsnip users.
|
||||||
|
-- { name = 'luasnip' }, -- For luasnip users.
|
||||||
|
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||||
|
-- { name = 'snippy' }, -- For snippy users.
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{ name = 'nvim_lsp_signature_help' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'numToStr/Comment.nvim',
|
||||||
|
opts = {
|
||||||
|
-- add any options here
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue