This commit is contained in:
2025-05-31 03:32:58 -04:00
parent ef678f31fd
commit e830931ff4
41 changed files with 253 additions and 268 deletions

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local map = misc.map
local map, auto = core.misc.map, core.misc.auto
return { "L3MON4D3/LuaSnip",
branch = "v2.4.0",
@ -55,14 +54,21 @@ return { "L3MON4D3/LuaSnip",
end
end)
-- load all snippets from snippet directory
-- collect all snippets and add them when in the correct file type
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua",
true)) do
local fn = file:gsub("^.*/", ""):gsub("%.lua$", "")
local ret = misc.include("snippets."..fn)
if type(ret) ~= "boolean" then
luasnip.add_snippets(fn, ret, { key = fn })
end
auto("FileType", {
pattern = fn,
once = true,
callback = function()
local ret = require("snippets."..fn)
if type(ret) ~= "boolean" then
luasnip.add_snippets(fn, ret, { key = fn })
end
end
})
end
end
}