-- ft=lua
local templates_dir = _USERHOME .. '/templates/'
local function load_snippets(language)
for template in lfs.dir(templates_dir) do
b, e, key = string.find(template, '^' .. language .. '%.(.+)$')
if b then
file = io.open(templates_dir .. template, 'r')
snippet = file:read('a')
file:close()
snippets[language] = snippets[language] or {}
snippets[language][key] = snippet
end
end
end
events.connect(events.LEXER_LOADED, load_snippets)
--[[
-- alternatively
events.connect(events.LEXER_LOADED,
function(language)
load_snippets(language)
-- other lexer-specific settings here
end)
--]]