Add snippet support

This commit is contained in:
ViViDboarder 2022-01-02 07:42:18 -08:00
parent 4b6d7a3efc
commit c01d2445ba

View File

@ -2,6 +2,7 @@ local M = {}
function M.config_cmp() function M.config_cmp()
local cmp = require("cmp") local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({ cmp.setup({
completion = { completion = {
completeopt = "menuone,noinsert,noselect", completeopt = "menuone,noinsert,noselect",
@ -19,6 +20,13 @@ function M.config_cmp()
mapping = { mapping = {
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), ["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<Tab>"] = cmp.mapping(function(fallback)
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end),
["<C-Space>"] = cmp.mapping(function() ["<C-Space>"] = cmp.mapping(function()
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()