feat: add <Plug> mappings

Problem: users who want keybindings must call Lua functions directly
or 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:00:00 -05:00
parent ca304930d2
commit 13b1f756c8
2 changed files with 13 additions and 0 deletions

View file

@ -16,6 +16,17 @@ USAGE *:HTTPCodes*
:HTTPCodes
<
===============================================================================
MAPPINGS *http-codes-mappings*
*<Plug>(http-codes-pick)*
<Plug>(http-codes-pick) Open the HTTP status code picker.
Equivalent to |:HTTPCodes|.
Example configuration: >lua
vim.keymap.set('n', '<leader>hc', '<Plug>(http-codes-pick)')
<
===============================================================================
CONFIGURATION *vim.g.http_codes*

View file

@ -6,3 +6,5 @@ vim.g.loaded_http_codes = 1
vim.api.nvim_create_user_command('HTTPCodes', function()
require('http-codes').pick()
end, {})
vim.keymap.set('n', '<Plug>(http-codes-pick)', function() require('http-codes').pick() end, { desc = 'Pick HTTP status code' })