From 13b1f756c8ed8a78fcab0bb200b3ea7585d6b266 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 7 Feb 2026 14:00:00 -0500 Subject: [PATCH 1/2] feat: add 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 mappings in the plugin file and document them in a new MAPPINGS section in the vimdoc. --- doc/http-codes.txt | 11 +++++++++++ plugin/http-codes.lua | 2 ++ 2 files changed, 13 insertions(+) diff --git a/doc/http-codes.txt b/doc/http-codes.txt index a348eb2..77f06b0 100644 --- a/doc/http-codes.txt +++ b/doc/http-codes.txt @@ -16,6 +16,17 @@ USAGE *:HTTPCodes* :HTTPCodes < +=============================================================================== +MAPPINGS *http-codes-mappings* + + *(http-codes-pick)* +(http-codes-pick) Open the HTTP status code picker. + Equivalent to |:HTTPCodes|. + +Example configuration: >lua + vim.keymap.set('n', 'hc', '(http-codes-pick)') +< + =============================================================================== CONFIGURATION *vim.g.http_codes* diff --git a/plugin/http-codes.lua b/plugin/http-codes.lua index d7e23df..b101269 100644 --- a/plugin/http-codes.lua +++ b/plugin/http-codes.lua @@ -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', '(http-codes-pick)', function() require('http-codes').pick() end, { desc = 'Pick HTTP status code' }) From 42fb4b5b2a168be74b77c7869024836055c5f16f Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 7 Feb 2026 14:01:22 -0500 Subject: [PATCH 2/2] fix(ci): run pre-commit --- plugin/http-codes.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/http-codes.lua b/plugin/http-codes.lua index b101269..b1f4490 100644 --- a/plugin/http-codes.lua +++ b/plugin/http-codes.lua @@ -7,4 +7,6 @@ vim.api.nvim_create_user_command('HTTPCodes', function() require('http-codes').pick() end, {}) -vim.keymap.set('n', '(http-codes-pick)', function() require('http-codes').pick() end, { desc = 'Pick HTTP status code' }) +vim.keymap.set('n', '(http-codes-pick)', function() + require('http-codes').pick() +end, { desc = 'Pick HTTP status code' })