luasnip: add globals for various types of snippets
This commit is contained in:
parent
208c31f2ba
commit
effec96b53
2 changed files with 15 additions and 7 deletions
|
@ -22,13 +22,20 @@ M.blankline = {
|
|||
show_current_context_start = true,
|
||||
}
|
||||
|
||||
M.luasnip = function()
|
||||
local options = { history = true, updateevents = "TextChanged,TextChangedI" }
|
||||
M.luasnip = function(opts)
|
||||
require("luasnip").config.set_config(opts)
|
||||
|
||||
require("luasnip").config.set_config(options)
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
|
||||
-- vscode format
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
|
||||
|
||||
-- snipmate format
|
||||
require("luasnip.loaders.from_snipmate").load()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
|
||||
|
||||
-- lua format
|
||||
require("luasnip.loaders.from_lua").load()
|
||||
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
|
|
|
@ -149,8 +149,9 @@ local default_plugins = {
|
|||
-- snippet plugin
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("plugins.configs.others").luasnip()
|
||||
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
|
||||
config = function(_, opts)
|
||||
require("plugins.configs.others").luasnip(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue