initial commit
This commit is contained in:
commit
dcb7debff6
29 changed files with 1276 additions and 0 deletions
24
lua/cp/snippets.lua
Normal file
24
lua/cp/snippets.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup(config)
|
||||
local has_luasnip, luasnip = pcall(require, 'luasnip')
|
||||
if not has_luasnip then
|
||||
return
|
||||
end
|
||||
|
||||
local snippets = {}
|
||||
|
||||
for name, snippet in pairs(config.snippets or {}) do
|
||||
if type(snippet) == 'table' and snippet.trig then
|
||||
table.insert(snippets, snippet)
|
||||
else
|
||||
table.insert(snippets, snippet)
|
||||
end
|
||||
end
|
||||
|
||||
if #snippets > 0 then
|
||||
luasnip.add_snippets('cpp', snippets)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue