docs: Add descriptions for <Plug> mappings

This commit is contained in:
polirritmico 2024-03-01 13:25:27 -03:00 committed by L3MON4D3
parent 814d3a3bd0
commit a7a4b4682c

View file

@ -2,61 +2,61 @@ vim.filetype.add({
extension = { snippets = "snippets" }, extension = { snippets = "snippets" },
}) })
local function silent_map(mode, lhs, rhs) local function silent_map(mode, lhs, rhs, desc)
vim.keymap.set(mode, lhs, rhs, { silent = true }) vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc or "" })
end end
silent_map("i", "<Plug>luasnip-expand-or-jump", function() silent_map("i", "<Plug>luasnip-expand-or-jump", function()
require("luasnip").expand_or_jump() require("luasnip").expand_or_jump()
end) end, "LuaSnip: Expand or jump in the current snippet")
silent_map("i", "<Plug>luasnip-expand-snippet", function() silent_map("i", "<Plug>luasnip-expand-snippet", function()
require("luasnip").expand() require("luasnip").expand()
end) end, "LuaSnip: Expand the current snippet")
silent_map("i", "<Plug>luasnip-next-choice", function() silent_map("i", "<Plug>luasnip-next-choice", function()
require("luasnip").change_choice(1) require("luasnip").change_choice(1)
end) end, "LuaSnip: Change to the next choice from the choiceNode")
silent_map("i", "<Plug>luasnip-prev-choice", function() silent_map("i", "<Plug>luasnip-prev-choice", function()
require("luasnip").change_choice(-1) require("luasnip").change_choice(-1)
end) end, "LuaSnip: Change to the previous choice from the choiceNode")
silent_map("i", "<Plug>luasnip-jump-next", function() silent_map("i", "<Plug>luasnip-jump-next", function()
require("luasnip").jump(1) require("luasnip").jump(1)
end) end, "LuaSnip: Jump to the next node")
silent_map("i", "<Plug>luasnip-jump-prev", function() silent_map("i", "<Plug>luasnip-jump-prev", function()
require("luasnip").jump(-1) require("luasnip").jump(-1)
end) end, "LuaSnip: Jump to the previous node")
silent_map("n", "<Plug>luasnip-delete-check", function() silent_map("n", "<Plug>luasnip-delete-check", function()
require("luasnip").unlink_current_if_deleted() require("luasnip").unlink_current_if_deleted()
end) end, "LuaSnip: Removes current snippet from jumplist")
silent_map("!", "<Plug>luasnip-delete-check", function() silent_map("!", "<Plug>luasnip-delete-check", function()
require("luasnip").unlink_current_if_deleted() require("luasnip").unlink_current_if_deleted()
end) end, "LuaSnip: Removes current snippet from jumplist")
silent_map("", "<Plug>luasnip-expand-repeat", function() silent_map("", "<Plug>luasnip-expand-repeat", function()
require("luasnip").expand_repeat() require("luasnip").expand_repeat()
end) end, "LuaSnip: Repeat last node expansion")
silent_map("!", "<Plug>luasnip-expand-repeat", function() silent_map("!", "<Plug>luasnip-expand-repeat", function()
require("luasnip").expand_repeat() require("luasnip").expand_repeat()
end) end, "LuaSnip: Repeat last node expansion")
silent_map("s", "<Plug>luasnip-expand-or-jump", function() silent_map("s", "<Plug>luasnip-expand-or-jump", function()
require("luasnip").expand_or_jump() require("luasnip").expand_or_jump()
end) end, "LuaSnip: Expand or jump in the current snippet")
silent_map("s", "<Plug>luasnip-expand-snippet", function() silent_map("s", "<Plug>luasnip-expand-snippet", function()
require("luasnip").expand() require("luasnip").expand()
end) end, "LuaSnip: Expand the current snippet")
silent_map("s", "<Plug>luasnip-next-choice", function() silent_map("s", "<Plug>luasnip-next-choice", function()
require("luasnip").change_choice(1) require("luasnip").change_choice(1)
end) end, "LuaSnip: Change to the next choice from the choiceNode")
silent_map("s", "<Plug>luasnip-prev-choice", function() silent_map("s", "<Plug>luasnip-prev-choice", function()
require("luasnip").change_choice(-1) require("luasnip").change_choice(-1)
end) end, "LuaSnip: Change to the previous choice from the choiceNode")
silent_map("s", "<Plug>luasnip-jump-next", function() silent_map("s", "<Plug>luasnip-jump-next", function()
require("luasnip").jump(1) require("luasnip").jump(1)
end) end, "LuaSnip: Jump to the next node")
silent_map("s", "<Plug>luasnip-jump-prev", function() silent_map("s", "<Plug>luasnip-jump-prev", function()
require("luasnip").jump(-1) require("luasnip").jump(-1)
end) end, "LuaSnip: Jump to the previous node")
vim.api.nvim_create_user_command("LuaSnipUnlinkCurrent", function() vim.api.nvim_create_user_command("LuaSnipUnlinkCurrent", function()
require("luasnip").unlink_current() require("luasnip").unlink_current()