feat(nvim): add a snippet for pcall
Useful when adding configuration files for new plugins.
This commit is contained in:
parent
251af8a126
commit
f6578a821a
|
@ -5,5 +5,12 @@ local rep = require("luasnip.extras").rep
|
||||||
local i = ls.insert_node
|
local i = ls.insert_node
|
||||||
|
|
||||||
return {
|
return {
|
||||||
req = fmt("local {} = require('{}')", { i(1), rep(1) })
|
req = fmt("local {} = require('{}')", { i(1), rep(1) }),
|
||||||
|
|
||||||
|
pcall = fmt([[
|
||||||
|
local status_ok, {} = pcall(require, "{}")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
]], { i(1), rep(1) })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue