feat: add <Plug> mappings

Problem: users who want keybindings must wrap commands in closures.
There is no stable public API for key binding.

Solution: define <Plug> mappings in the plugin file and document them
in a new MAPPINGS section in the vimdoc.
This commit is contained in:
Barrett Ruth 2026-02-07 14:12:49 -05:00
parent 4dc650957b
commit 97a6fb2bd7
2 changed files with 24 additions and 0 deletions

View file

@ -40,3 +40,11 @@ vim.api.nvim_create_autocmd('OptionSet', {
end
end,
})
local cmds = require('diffs.commands')
vim.keymap.set('n', '<Plug>(diffs-gdiff)', function()
cmds.gdiff(nil, false)
end, { desc = 'Unified diff (horizontal)' })
vim.keymap.set('n', '<Plug>(diffs-gvdiff)', function()
cmds.gdiff(nil, true)
end, { desc = 'Unified diff (vertical)' })