feat(nvim): add a snippet for pcall

Useful when adding configuration files for new plugins.
This commit is contained in:
Oliver Davies 2022-02-16 08:18:32 +00:00
parent 251af8a126
commit f6578a821a

View file

@ -5,5 +5,12 @@ local rep = require("luasnip.extras").rep
local i = ls.insert_node
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) })
}