feat: mini.pairs toggle

This commit is contained in:
Folke Lemaitre 2024-07-15 15:08:13 +02:00
parent 50b3050d30
commit 4d9407dc22
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 16 additions and 14 deletions

View file

@ -121,6 +121,15 @@ end
---@param opts {skip_next: string, skip_ts: string[], skip_unbalanced: boolean, markdown: boolean}
function M.pairs(opts)
LazyVim.toggle.map("<leader>up", {
name = "Mini Pairs",
get = function()
return not vim.g.minipairs_disable
end,
set = function(state)
vim.g.minipairs_disable = not state
end,
})
local pairs = require("mini.pairs")
pairs.setup(opts)
local open = pairs.open

View file

@ -21,6 +21,13 @@ function M.map(lhs, toggle)
LazyVim.warn("Disabled " .. toggle.name, { title = toggle.name })
end
end, { desc = "Toggle" .. toggle.name })
M.wk(lhs, toggle)
end
function M.wk(lhs, toggle)
if not LazyVim.has("which-key.nvim") then
return
end
require("which-key").add({
{
lhs,