diff --git a/roles/neovim/files/lua/opdavies/snippets/ft/lua.lua b/roles/neovim/files/lua/opdavies/snippets/ft/lua.lua index 13c63fd..acdb3eb 100644 --- a/roles/neovim/files/lua/opdavies/snippets/ft/lua.lua +++ b/roles/neovim/files/lua/opdavies/snippets/ft/lua.lua @@ -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) }) }