luasnip: add globals for various types of snippets
This commit is contained in:
parent
208c31f2ba
commit
effec96b53
|
@ -22,13 +22,20 @@ M.blankline = {
|
||||||
show_current_context_start = true,
|
show_current_context_start = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
M.luasnip = function()
|
M.luasnip = function(opts)
|
||||||
local options = { history = true, updateevents = "TextChanged,TextChangedI" }
|
require("luasnip").config.set_config(opts)
|
||||||
|
|
||||||
require("luasnip").config.set_config(options)
|
-- vscode format
|
||||||
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
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", {
|
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||||
callback = function()
|
callback = function()
|
||||||
|
|
|
@ -149,8 +149,9 @@ local default_plugins = {
|
||||||
-- snippet plugin
|
-- snippet plugin
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
dependencies = "rafamadriz/friendly-snippets",
|
dependencies = "rafamadriz/friendly-snippets",
|
||||||
config = function()
|
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
|
||||||
require("plugins.configs.others").luasnip()
|
config = function(_, opts)
|
||||||
|
require("plugins.configs.others").luasnip(opts)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue