Move nvim-cmp config into lspconfig, tidy up cmp settings
This commit is contained in:
parent
82485e5ab0
commit
0516fde7d3
|
@ -2,8 +2,6 @@ local cmp = require "cmp"
|
||||||
local luasnip = require "luasnip"
|
local luasnip = require "luasnip"
|
||||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||||
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
|
@ -44,55 +42,12 @@ cmp.setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Set configuration for specific filetype.
|
-- Set configuration for specific filetype.
|
||||||
cmp.setup.filetype("python", {
|
cmp.setup.filetype("python", { sources = { { name = "nvim_lsp" } } })
|
||||||
sources = {
|
cmp.setup.filetype("nix", { sources = { { name = "nvim_lsp" } } })
|
||||||
{ name = "nvim_lsp" },
|
cmp.setup.cmdline("/", { mapping = cmp.mapping.preset.cmdline(), sources = { { name = "buffer" } } })
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.filetype("nix", {
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.filetype("gitcommit", {
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "git" },
|
|
||||||
{ name = "spell" },
|
|
||||||
{ name = "commit" },
|
|
||||||
{ name = "buffer" },
|
|
||||||
{ name = "luasnip" },
|
|
||||||
{ name = "latex_symbols" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.filetype("markdown", {
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "spell" },
|
|
||||||
{ name = "buffer" },
|
|
||||||
{ name = "luasnip" },
|
|
||||||
{ name = "latex_symbols" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.cmdline("/", {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "buffer" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.cmdline(":", {
|
cmp.setup.cmdline(":", {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = {
|
sources = { { name = "cmdline" }, { name = "path" } },
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "path" },
|
|
||||||
{ name = "cmdline" },
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
|
|
|
@ -1,22 +1,15 @@
|
||||||
return {
|
return {
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
event = { "BufReadPre", "BufNewFile", "BufEnter" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
cmd = {
|
|
||||||
"LspLog",
|
|
||||||
"LspStop",
|
|
||||||
"LspStart",
|
|
||||||
"LspRestart",
|
|
||||||
"LspInfo",
|
|
||||||
},
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "hrsh7th/nvim-cmp" },
|
{ "hrsh7th/cmp-nvim-lsp", dependencies = { "hrsh7th/nvim-cmp" } },
|
||||||
{ "rafamadriz/friendly-snippets" },
|
{ "hrsh7th/cmp-buffer", dependencies = { "hrsh7th/nvim-cmp" } },
|
||||||
{ "windwp/nvim-autopairs" },
|
{ "hrsh7th/cmp-path", dependencies = { "hrsh7th/nvim-cmp" } },
|
||||||
{ "jose-elias-alvarez/null-ls.nvim", lazy = true },
|
{ "hrsh7th/cmp-cmdline", dependencies = { "hrsh7th/nvim-cmp" } },
|
||||||
{ "mfussenegger/nvim-dap", lazy = true },
|
{ "L3MON4D3/LuaSnip", dependencies = { "hrsh7th/nvim-cmp", "saadparwaiz1/cmp_luasnip" } },
|
||||||
{ "folke/neodev.nvim", dependencies = { "hrsh7th/nvim-cmp" }, lazy = true },
|
{ "windwp/nvim-autopairs", dependencies = { "hrsh7th/nvim-cmp" } },
|
||||||
{ "SmiteshP/nvim-navic" },
|
{ "folke/neodev.nvim", dependencies = { "hrsh7th/nvim-cmp" } },
|
||||||
{ "SmiteshP/nvim-navbuddy" },
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require "lsp.config"
|
require "lsp.config"
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
return {
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
dependencies = {
|
|
||||||
{ "hrsh7th/cmp-nvim-lsp" },
|
|
||||||
{ "hrsh7th/cmp-buffer" },
|
|
||||||
{ "hrsh7th/cmp-path" },
|
|
||||||
{ "hrsh7th/cmp-cmdline" },
|
|
||||||
{ "f3fora/cmp-spell" },
|
|
||||||
{ "petertriho/cmp-git" },
|
|
||||||
{ "Dosx001/cmp-commit" },
|
|
||||||
{ "kdheepak/cmp-latex-symbols" },
|
|
||||||
{ "L3MON4D3/LuaSnip" },
|
|
||||||
{ "saadparwaiz1/cmp_luasnip" },
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
return {
|
return {
|
||||||
"SmiteshP/nvim-navbuddy",
|
"SmiteshP/nvim-navbuddy",
|
||||||
dependencies = { "SmiteshP/nvim-navic", "MunifTanjim/nui.nvim" },
|
dependencies = { "SmiteshP/nvim-navic", "MunifTanjim/nui.nvim", "neovim/nvim-lspconfig" },
|
||||||
cmd = { "Navbuddy" },
|
cmd = { "Navbuddy" },
|
||||||
init = function() vim.keymap.set("n", "<leader>na", "<cmd>Navbuddy<cr>") end,
|
init = function() vim.keymap.set("n", "<leader>na", "<cmd>Navbuddy<cr>") end,
|
||||||
config = true,
|
config = true,
|
||||||
|
|
|
@ -51,7 +51,6 @@ return {
|
||||||
require("telescope").load_extension "fzf"
|
require("telescope").load_extension "fzf"
|
||||||
require("telescope").load_extension "lazy"
|
require("telescope").load_extension "lazy"
|
||||||
require("telescope").load_extension "noice"
|
require("telescope").load_extension "noice"
|
||||||
require("telescope").load_extension "luasnip"
|
|
||||||
require("telescope").load_extension "git_diffs"
|
require("telescope").load_extension "git_diffs"
|
||||||
require("telescope").load_extension "command_center"
|
require("telescope").load_extension "command_center"
|
||||||
require("telescope").load_extension "http"
|
require("telescope").load_extension "http"
|
||||||
|
|
Loading…
Reference in a new issue