wozers
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user