Add tab bindings for luasnip

This commit is contained in:
pro100ton 2024-11-16 10:46:26 +03:00
parent cca7a8d750
commit ac03f482fb
2 changed files with 80 additions and 59 deletions

View file

@ -41,7 +41,26 @@ return {
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm { select = true },
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
-- sources for autocompletion
-- !! Priority is important - autocompletion will be ordered from top to bottom

View file

@ -15,7 +15,9 @@ return {
},
},
templates = {
folder = "Templates"
folder = "Templates",
date_format = "%d.%m.%Y",
time_format = "%H:%M",
},
-- disable adding properties on top of file on save
disable_frontmatter = true,