chore(nvim): improve nvim-cmp
parent
5dcc72af1a
commit
8265729511
|
@ -332,7 +332,6 @@ require("lazy").setup({
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
["<C-e>"] = cmp.mapping.abort(),
|
|
||||||
["<CR>"] = cmp.mapping.confirm({
|
["<CR>"] = cmp.mapping.confirm({
|
||||||
select = false,
|
select = false,
|
||||||
behavior = cmp.ConfirmBehavior.Insert,
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
@ -344,6 +343,8 @@ require("lazy").setup({
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "copilot" },
|
{ name = "copilot" },
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
|
}, {
|
||||||
|
{ name = "buffer" },
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
@ -484,7 +485,11 @@ require("lazy").setup({
|
||||||
local augroup = vim.api.nvim_create_augroup("UserNeoformatConfig", {})
|
local augroup = vim.api.nvim_create_augroup("UserNeoformatConfig", {})
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
pattern = { "*.lua", "*.md" },
|
pattern = {
|
||||||
|
"*.go",
|
||||||
|
"*.lua",
|
||||||
|
"*.md",
|
||||||
|
},
|
||||||
command = "Neoformat",
|
command = "Neoformat",
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
@ -540,9 +545,15 @@ require("lazy").setup({
|
||||||
-- https://github.com/neovim/nvim-lspconfig
|
-- https://github.com/neovim/nvim-lspconfig
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
-- Support nvim-cmp
|
||||||
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
-- Go
|
-- Go
|
||||||
-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md
|
-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md
|
||||||
-- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
|
-- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
|
||||||
|
@ -557,6 +568,7 @@ require("lazy").setup({
|
||||||
semanticTokens = true,
|
semanticTokens = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Proto
|
-- Proto
|
||||||
|
|
Loading…
Reference in New Issue