mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-23 04:27:36 +00:00
Add snippet support
This commit is contained in:
parent
4b6d7a3efc
commit
c01d2445ba
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user