diff --git a/Examples/snippets.lua b/Examples/snippets.lua index 2d2e63efc..88777e610 100644 --- a/Examples/snippets.lua +++ b/Examples/snippets.lua @@ -8,8 +8,8 @@ local f = ls.function_node local c = ls.choice_node local d = ls.dynamic_node local l = require("luasnip.extras").lambda -local r = require("luasnip.util.functions").rep -local p = require("luasnip.util.functions").partial +local r = require("luasnip.extras").rep +local p = require("luasnip.extras").partial -- Every unspecified option will be set to the default. ls.config.set_config({ diff --git a/lua/luasnip/extras/init.lua b/lua/luasnip/extras/init.lua index e0867ad8d..ee916b2f1 100644 --- a/lua/luasnip/extras/init.lua +++ b/lua/luasnip/extras/init.lua @@ -73,6 +73,19 @@ end return { lambda = lambda, match = match, + -- repeat a node. + rep = function(node_indx) + return F(function(args) + return args[1] + end, node_indx) + end, + -- Insert the output of a function. + partial = function(func, ...) + return F(function(_, fn, ...) + return fn(...) + end, {}, func, ...) + end, + --alias l = lambda, m = match, diff --git a/lua/luasnip/util/functions.lua b/lua/luasnip/util/functions.lua index e92960fd3..b06f310b1 100644 --- a/lua/luasnip/util/functions.lua +++ b/lua/luasnip/util/functions.lua @@ -1,5 +1,3 @@ -local f = require("luasnip.nodes.functionNode").F - return { -- supported lsp-vars. lsp = { @@ -18,16 +16,4 @@ return { copy = function(args) return args[1] end, - -- repeat a node. - rep = function(node_indx) - return f(function(args) - return args[1] - end, node_indx) - end, - -- Insert the output of a function. - partial = function(func, ...) - return f(function(_, fn, ...) - return fn(...) - end, {}, func, ...) - end, }