From a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32 Mon Sep 17 00:00:00 2001 From: polirritmico Date: Fri, 1 Mar 2024 13:25:27 -0300 Subject: [PATCH] docs: Add descriptions for mappings --- plugin/luasnip.lua | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/plugin/luasnip.lua b/plugin/luasnip.lua index f6d2738..420e4c0 100644 --- a/plugin/luasnip.lua +++ b/plugin/luasnip.lua @@ -2,61 +2,61 @@ vim.filetype.add({ extension = { snippets = "snippets" }, }) -local function silent_map(mode, lhs, rhs) - vim.keymap.set(mode, lhs, rhs, { silent = true }) +local function silent_map(mode, lhs, rhs, desc) + vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc or "" }) end silent_map("i", "luasnip-expand-or-jump", function() require("luasnip").expand_or_jump() -end) +end, "LuaSnip: Expand or jump in the current snippet") silent_map("i", "luasnip-expand-snippet", function() require("luasnip").expand() -end) +end, "LuaSnip: Expand the current snippet") silent_map("i", "luasnip-next-choice", function() require("luasnip").change_choice(1) -end) +end, "LuaSnip: Change to the next choice from the choiceNode") silent_map("i", "luasnip-prev-choice", function() require("luasnip").change_choice(-1) -end) +end, "LuaSnip: Change to the previous choice from the choiceNode") silent_map("i", "luasnip-jump-next", function() require("luasnip").jump(1) -end) +end, "LuaSnip: Jump to the next node") silent_map("i", "luasnip-jump-prev", function() require("luasnip").jump(-1) -end) +end, "LuaSnip: Jump to the previous node") silent_map("n", "luasnip-delete-check", function() require("luasnip").unlink_current_if_deleted() -end) +end, "LuaSnip: Removes current snippet from jumplist") silent_map("!", "luasnip-delete-check", function() require("luasnip").unlink_current_if_deleted() -end) +end, "LuaSnip: Removes current snippet from jumplist") silent_map("", "luasnip-expand-repeat", function() require("luasnip").expand_repeat() -end) +end, "LuaSnip: Repeat last node expansion") silent_map("!", "luasnip-expand-repeat", function() require("luasnip").expand_repeat() -end) +end, "LuaSnip: Repeat last node expansion") silent_map("s", "luasnip-expand-or-jump", function() require("luasnip").expand_or_jump() -end) +end, "LuaSnip: Expand or jump in the current snippet") silent_map("s", "luasnip-expand-snippet", function() require("luasnip").expand() -end) +end, "LuaSnip: Expand the current snippet") silent_map("s", "luasnip-next-choice", function() require("luasnip").change_choice(1) -end) +end, "LuaSnip: Change to the next choice from the choiceNode") silent_map("s", "luasnip-prev-choice", function() require("luasnip").change_choice(-1) -end) +end, "LuaSnip: Change to the previous choice from the choiceNode") silent_map("s", "luasnip-jump-next", function() require("luasnip").jump(1) -end) +end, "LuaSnip: Jump to the next node") silent_map("s", "luasnip-jump-prev", function() require("luasnip").jump(-1) -end) +end, "LuaSnip: Jump to the previous node") vim.api.nvim_create_user_command("LuaSnipUnlinkCurrent", function() require("luasnip").unlink_current()