From 5adf2341f3ee7aa0699f9f5278b6654534a09636 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Thu, 26 Feb 2026 23:25:39 -0500 Subject: [PATCH] feat(filter): wire F key and (pending-filter) mapping (#53) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(config): remove legacy gcal top-level config key Problem: the gcal migration shim silently accepted vim.g.pending = { gcal = {...} } and copied it to sync.gcal, adding complexity and a deprecated API surface. Solution: remove the migration block in config.get(), drop the cfg.gcal fallback in gcal_config(), delete the two migration tests, and clean up the vimdoc references. Callers must now use sync.gcal directly. * ci: fix * fix(spec): remove duplicate buffer require in complete_spec * docs(pending): reorganize vimdoc and fix incorrect defaults Problem: sections were out of logical order — inline metadata appeared before commands, GCal before its own backend framework, store resolution duplicated and buried after health check. Two defaults were wrong: default_category documented as 'Inbox' (should be 'Todo') and the gcal calendar example used 'Tasks' (should be 'Pendings'). Solution: reorder all 21 sections into onboarding-first flow, add a CONTENTS table with hyperlinks, fix both incorrect defaults in every location they appeared, and remove the duplicate STORE RESOLUTION section. * feat(filter): wire F key and (pending-filter) mapping Problem: the filter predicate logic, diff guard, _on_write handling, :Pending filter command, and filter_spec were already implemented, but there was no buffer-local key to invoke filtering interactively. Solution: add filter = 'F' to keymaps config and defaults, wire the filter action in _setup_buf_mappings via vim.ui.input, add (pending-filter), and update the vimdoc (mappings table, Plug section, config example, and FILTERS section). --- doc/pending.txt | 9 ++++++++- lua/pending/config.lua | 2 ++ lua/pending/init.lua | 7 +++++++ plugin/pending.lua | 8 ++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/doc/pending.txt b/doc/pending.txt index 56a87d5..5543516 100644 --- a/doc/pending.txt +++ b/doc/pending.txt @@ -244,6 +244,7 @@ Default buffer-local keys: ~ `` Toggle complete / uncomplete (`toggle`) `!` Toggle the priority flag (`priority`) `D` Prompt for a due date (`date`) + `F` Prompt for filter predicates (`filter`) `` Switch between category / queue view (`view`) `U` Undo the last `:w` save (`undo`) `o` Insert a new task line below (`open_line`) @@ -309,6 +310,10 @@ All motions support count: `3]]` jumps three headers forward. `]]` and (pending-undo) Undo the last `:w` save. + *(pending-filter)* +(pending-filter) + Prompt for filter predicates via |vim.ui.input|. + *(pending-open-line)* (pending-open-line) Insert a correctly-formatted blank task line below the cursor. @@ -385,7 +390,8 @@ Hidden tasks are preserved in the store and reappear when the filter is cleared. Filter state is session-local — it does not persist across Neovim restarts. -Set a filter with |:Pending-filter| or by editing the `FILTER:` line: >vim +Set a filter with |:Pending-filter|, the `F` buffer key, or by editing the +`FILTER:` line: >vim :Pending filter cat:Work overdue < @@ -567,6 +573,7 @@ loads: >lua priority = '!', date = 'D', undo = 'U', + filter = 'F', open_line = 'o', open_line_above = 'O', a_task = 'at', diff --git a/lua/pending/config.lua b/lua/pending/config.lua index d8df30e..153c71f 100644 --- a/lua/pending/config.lua +++ b/lua/pending/config.lua @@ -21,6 +21,7 @@ ---@field priority? string|false ---@field date? string|false ---@field undo? string|false +---@field filter? string|false ---@field open_line? string|false ---@field open_line_above? string|false ---@field a_task? string|false @@ -67,6 +68,7 @@ local defaults = { priority = '!', date = 'D', undo = 'U', + filter = 'F', open_line = 'o', open_line_above = 'O', a_task = 'at', diff --git a/lua/pending/init.lua b/lua/pending/init.lua index bb17617..12b6a7e 100644 --- a/lua/pending/init.lua +++ b/lua/pending/init.lua @@ -243,6 +243,13 @@ function M._setup_buf_mappings(bufnr) undo = function() M.undo_write() end, + filter = function() + vim.ui.input({ prompt = 'Filter: ' }, function(input) + if input then + M.filter(input) + end + end) + end, open_line = function() buffer.open_line(false) end, diff --git a/plugin/pending.lua b/plugin/pending.lua index 0350b73..f533dcf 100644 --- a/plugin/pending.lua +++ b/plugin/pending.lua @@ -258,6 +258,14 @@ vim.keymap.set('n', '(pending-undo)', function() require('pending').undo_write() end) +vim.keymap.set('n', '(pending-filter)', function() + vim.ui.input({ prompt = 'Filter: ' }, function(input) + if input then + require('pending').filter(input) + end + end) +end) + vim.keymap.set('n', '(pending-open-line)', function() require('pending.buffer').open_line(false) end)