Skip to content

Commit

Permalink
feat: support user customized snippets.
Browse files Browse the repository at this point in the history
  • Loading branch information
ayamir committed Jan 2, 2025
1 parent 22b8452 commit a2c0796
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lua/modules/configs/completion/luasnip.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
return function()
local snippet_path = vim.fn.stdpath("config") .. "/snips/"
if not vim.tbl_contains(vim.opt.rtp:get(), snippet_path) then
vim.opt.rtp:append(snippet_path)
end
local vim_path = require("core.global").vim_path
local snippet_path = vim_path .. "/snips/"
local user_snippet_path = vim_path .. "/lua/user/snips/"

require("modules.utils").load_plugin("luasnip", {
history = true,
update_events = "TextChanged,TextChangedI",
delete_check_events = "TextChanged,InsertLeave",
}, false, require("luasnip").config.set_config)

require("luasnip.loaders.from_vscode").lazy_load({
paths = {
snippet_path,
user_snippet_path,
},
})
require("luasnip.loaders.from_lua").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_snipmate").lazy_load()
Expand Down

0 comments on commit a2c0796

Please sign in to comment.