Move nvim-cmp config into lspconfig, tidy up cmp settings

This commit is contained in:
Evie Litherland-Smith 2023-05-16 12:34:56 +01:00
parent 82485e5ab0
commit 0516fde7d3
5 changed files with 14 additions and 82 deletions

View file

@ -2,8 +2,6 @@ local cmp = require "cmp"
local luasnip = require "luasnip"
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup {
snippet = {
expand = function(args)
@ -44,55 +42,12 @@ cmp.setup {
}
-- Set configuration for specific filetype.
cmp.setup.filetype("python", {
sources = {
{ name = "nvim_lsp" },
},
})
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.filetype("python", { sources = { { name = "nvim_lsp" } } })
cmp.setup.filetype("nix", { sources = { { name = "nvim_lsp" } } })
cmp.setup.cmdline("/", { mapping = cmp.mapping.preset.cmdline(), sources = { { name = "buffer" } } })
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "cmdline" },
},
sources = { { name = "cmdline" }, { name = "path" } },
})
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())

View file

@ -1,22 +1,15 @@
return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile", "BufEnter" },
cmd = {
"LspLog",
"LspStop",
"LspStart",
"LspRestart",
"LspInfo",
},
event = { "BufReadPre", "BufNewFile" },
dependencies = {
{ "hrsh7th/nvim-cmp" },
{ "rafamadriz/friendly-snippets" },
{ "windwp/nvim-autopairs" },
{ "jose-elias-alvarez/null-ls.nvim", lazy = true },
{ "mfussenegger/nvim-dap", lazy = true },
{ "folke/neodev.nvim", dependencies = { "hrsh7th/nvim-cmp" }, lazy = true },
{ "SmiteshP/nvim-navic" },
{ "SmiteshP/nvim-navbuddy" },
{ "hrsh7th/cmp-nvim-lsp", dependencies = { "hrsh7th/nvim-cmp" } },
{ "hrsh7th/cmp-buffer", dependencies = { "hrsh7th/nvim-cmp" } },
{ "hrsh7th/cmp-path", dependencies = { "hrsh7th/nvim-cmp" } },
{ "hrsh7th/cmp-cmdline", dependencies = { "hrsh7th/nvim-cmp" } },
{ "L3MON4D3/LuaSnip", dependencies = { "hrsh7th/nvim-cmp", "saadparwaiz1/cmp_luasnip" } },
{ "windwp/nvim-autopairs", dependencies = { "hrsh7th/nvim-cmp" } },
{ "folke/neodev.nvim", dependencies = { "hrsh7th/nvim-cmp" } },
"jose-elias-alvarez/null-ls.nvim",
},
config = function()
require "lsp.config"

View file

@ -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" },
},
}

View file

@ -1,6 +1,6 @@
return {
"SmiteshP/nvim-navbuddy",
dependencies = { "SmiteshP/nvim-navic", "MunifTanjim/nui.nvim" },
dependencies = { "SmiteshP/nvim-navic", "MunifTanjim/nui.nvim", "neovim/nvim-lspconfig" },
cmd = { "Navbuddy" },
init = function() vim.keymap.set("n", "<leader>na", "<cmd>Navbuddy<cr>") end,
config = true,

View file

@ -51,7 +51,6 @@ return {
require("telescope").load_extension "fzf"
require("telescope").load_extension "lazy"
require("telescope").load_extension "noice"
require("telescope").load_extension "luasnip"
require("telescope").load_extension "git_diffs"
require("telescope").load_extension "command_center"
require("telescope").load_extension "http"