dotfiles/.config/nvim/lua/plugins/no-neck-pain.lua

55 lines
1.3 KiB
Lua

local function mapPrefix(prefix, enabled)
-- create the WK group for the prefix
require("which-key").add({
{ prefix, group = "+NoNeckPain" },
})
-- define the suffix mappings
local mappings = {
toggle = "p",
toggleLeftSide = "ql",
toggleRightSide = "qr",
widthUp = "=",
widthDown = "-",
scratchPad = "s",
}
-- concat prefix and suffix
for action, suffix in pairs(mappings) do
mappings[action] = prefix .. suffix
end
-- include the enabled flag
mappings.enabled = enabled
return mappings
end
-- Ok, this plugin is really awesome!
-- And everyone should know about it -- game changer!!!
return {
"shortcuts/no-neck-pain.nvim",
version = "*",
opts = function()
return {
width = 120,
mappings = mapPrefix("<leader>N", true),
-- mappings = {
-- enabled = true,
-- },
autocmds = {
enableOnVimEnter = true,
skipEnteringNoNeckPainBuffer = true,
},
buffers = {
left = {
scratchPad = {
enabled = false,
pathToFile = "~/SyncDocuments/scratch-l.md",
},
},
right = {
scratchPad = {
enabled = false,
pathToFile = "~/SyncDocuments/scratch-r.md",
},
},
},
}
end,
}