From df4c9e0d880c198f7d72033a77680c7ebbaa888c Mon Sep 17 00:00:00 2001 From: Nikolai Papin Date: Mon, 28 Jul 2025 11:52:29 +0300 Subject: [PATCH] feat: error log snippet for go; changed events for the relative-toggle plugin --- nvim/lua/plugins/relative-toggle.lua | 4 ++-- nvim/lua/snippets/go.lua | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 nvim/lua/snippets/go.lua diff --git a/nvim/lua/plugins/relative-toggle.lua b/nvim/lua/plugins/relative-toggle.lua index 2fd09e1..a34d557 100644 --- a/nvim/lua/plugins/relative-toggle.lua +++ b/nvim/lua/plugins/relative-toggle.lua @@ -5,8 +5,8 @@ return { require("relative-toggle").setup({ pattern = "*", events = { - on = { "BufEnter", "FocusGained", "InsertLeave", "WinEnter", "CmdlineLeave" }, - off = { "BufLeave", "FocusLost", "InsertEnter", "WinLeave", "CmdlineEnter" }, + on = { "InsertLeave" }, + off = { "InsertEnter" }, }, }) end diff --git a/nvim/lua/snippets/go.lua b/nvim/lua/snippets/go.lua new file mode 100644 index 0000000..599a819 --- /dev/null +++ b/nvim/lua/snippets/go.lua @@ -0,0 +1,14 @@ +local ls = require("luasnip") +local s = ls.snippet +local t = ls.text_node +local i = ls.insert_node + +return { + -- zap log contents the way i like it + s("zaplog", { + t({ "", "" }), + t({ "\t\"" }), i(1), t({ "\"," }), i(3), + t({ "\t", "\tzap.Error(" }), i(2), t({ ")" }) + }), +} +