From f188ec589d1ab079aeafdbc271f8d8d2ae695555 Mon Sep 17 00:00:00 2001 From: Daniil Tsivinsky Date: Wed, 21 May 2025 20:04:11 +0300 Subject: [PATCH] neovim: update `iferr` snippet --- neovim/.config/nvim/after/plugin/comp.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/neovim/.config/nvim/after/plugin/comp.lua b/neovim/.config/nvim/after/plugin/comp.lua index ec960ea..2cc80f6 100644 --- a/neovim/.config/nvim/after/plugin/comp.lua +++ b/neovim/.config/nvim/after/plugin/comp.lua @@ -122,7 +122,7 @@ ls.add_snippets("go", { fmt( [[ if err != nil { - return <> + <> } ]], { @@ -168,7 +168,12 @@ ls.add_snippets("go", { } local size = vim.tbl_count(params) - local x = {} + + if size == 0 then + return sn(nil, { i(1) }) + end + + local x = { t("return ") } for index, param in ipairs(params) do local replace = rec[param] if replace ~= nil then