2024-02-29 16:33:20 +00:00
|
|
|
return {
|
|
|
|
"hrsh7th/nvim-cmp",
|
|
|
|
event = "InsertEnter",
|
|
|
|
|
|
|
|
opts = function()
|
2024-03-04 02:37:10 +00:00
|
|
|
return require "nvchad.configs.cmp"
|
2024-02-29 16:33:20 +00:00
|
|
|
end,
|
|
|
|
|
|
|
|
config = function(_, opts)
|
|
|
|
require("cmp").setup(opts)
|
|
|
|
end,
|
|
|
|
|
|
|
|
dependencies = {
|
|
|
|
{
|
|
|
|
-- snippet plugin
|
|
|
|
"L3MON4D3/LuaSnip",
|
|
|
|
dependencies = "rafamadriz/friendly-snippets",
|
|
|
|
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
|
|
|
|
config = function(_, opts)
|
|
|
|
require("luasnip").config.set_config(opts)
|
|
|
|
|
|
|
|
require("luasnip.loaders.from_vscode").lazy_load()
|
|
|
|
require("luasnip.loaders.from_snipmate").load()
|
|
|
|
require("luasnip.loaders.from_lua").load()
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd("InsertLeave", {
|
|
|
|
callback = function()
|
|
|
|
if
|
|
|
|
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
|
|
|
|
and not require("luasnip").session.jump_active
|
|
|
|
then
|
|
|
|
require("luasnip").unlink_current()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
|
|
|
|
-- autopairing of (){}[] etc
|
|
|
|
{
|
|
|
|
"windwp/nvim-autopairs",
|
|
|
|
opts = {
|
|
|
|
fast_wrap = {},
|
|
|
|
disable_filetype = { "TelescopePrompt", "vim" },
|
|
|
|
},
|
|
|
|
config = function(_, opts)
|
|
|
|
require("nvim-autopairs").setup(opts)
|
|
|
|
|
|
|
|
-- setup cmp for autopairs
|
|
|
|
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
|
|
|
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
|
|
|
|
-- cmp sources plugins
|
|
|
|
{
|
|
|
|
"saadparwaiz1/cmp_luasnip",
|
|
|
|
"hrsh7th/cmp-nvim-lua",
|
|
|
|
"hrsh7th/cmp-nvim-lsp",
|
|
|
|
"hrsh7th/cmp-buffer",
|
|
|
|
"hrsh7th/cmp-path",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|