feat(textobj): add debug mode, rename priority view buffer

Problem: the ]] motion reportedly lands one line past the header in
some environments, and ]t/[t may not override Neovim defaults. No
way to diagnose these at runtime. Also, pending://priority is a poor
buffer name for the flat ranked view.

Solution: add a debug config option (vim.g.pending = { debug = true })
that logs meta state, cursor positions, and mapping registration to
:messages at DEBUG level. Rename the buffer from pending://priority to
pending://queue. Internal view identifier stays 'priority'.
This commit is contained in:
Barrett Ruth 2026-02-26 16:01:56 -05:00
parent cf1f5c39d8
commit 278a81330f
4 changed files with 44 additions and 1 deletions

View file

@ -140,8 +140,15 @@ function M._setup_buf_mappings(bufnr)
prev_task = textobj.prev_task,
}
local dbg = config.get().debug
for name, fn in pairs(motions) do
local key = km[name]
if dbg then
vim.notify(
('[pending] mapping motion %s → %s (buf=%d)'):format(name, key or 'nil', bufnr),
vim.log.levels.DEBUG
)
end
if key and key ~= false then
vim.keymap.set({ 'n', 'x', 'o' }, key --[[@as string]], function()
fn(vim.v.count1)