return { { "L3MON4D3/LuaSnip", version = "2.*", dependencies = { "rafamadriz/friendly-snippets", "mireq/luasnip-snippets", }, build = "make install_jsregexp", config = function() -- Setup -- require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_snipmate").lazy_load() require("luasnip_snippets.common.snip_utils").setup() end, }, { "hrsh7th/nvim-cmp", dependencies = { "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip", "hrsh7th/cmp-nvim-lsp", }, config = function() -- Setup -- local cmp = require("cmp") local luasnip = require("luasnip") luasnip.setup({ load_ft_func = require("luasnip_snippets.common.snip_utils").load_ft_func, ft_func = require("luasnip_snippets.common.snip_utils").ft_func, enable_autosnippets = true, }) -- Keybinding -- vim.keymap.set({ "i", "s" }, "", function() if luasnip.expand_or_jumpable() then luasnip.expand_or_jump() else vim.api.nvim_input("") end end, { silent = true }) vim.keymap.set({ "i", "s" }, "", function() luasnip.jump(-1) end, { silent = true }) -- Setup -- cmp.setup({ snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert({ -- Keybinding -- [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), [""] = cmp.mapping.confirm({ select = true }), }), sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "luasnip" }, }, { { name = "buffer" } }), }) end, }, }