feat(buffer): add configurable category-level folds (#91)
Problem: category folds were hardcoded with no config option, no custom foldtext, and no vimdoc coverage. Solution: add `folding` config field (boolean or table with `foldtext` format string). Default foldtext is `%c (%n tasks)` with automatic singular/plural. Gate all fold logic on the config so `folding = false` disables folds entirely. Document the new option in vimdoc.
This commit is contained in:
parent
12b9295c34
commit
c392874311
3 changed files with 84 additions and 6 deletions
|
|
@ -38,7 +38,7 @@ Features: ~
|
|||
- Multi-level undo (up to 20 `:w` saves, persisted across sessions)
|
||||
- Quick-add from the command line with `:Pending add`
|
||||
- Quickfix list of overdue/due-today tasks via `:Pending due`
|
||||
- Foldable category sections (`zc`/`zo`) in category view
|
||||
- Configurable category folds (`zc`/`zo`) with custom foldtext
|
||||
- Omnifunc completion for `cat:`, `due:`, and `rec:` tokens (`<C-x><C-o>`)
|
||||
- Google Calendar one-way push via OAuth PKCE
|
||||
- Google Tasks bidirectional sync via OAuth PKCE
|
||||
|
|
@ -274,8 +274,8 @@ Default buffer-local keys: ~
|
|||
`U` Undo the last `:w` save (`undo`)
|
||||
`o` Insert a new task line below (`open_line`)
|
||||
`O` Insert a new task line above (`open_line_above`)
|
||||
`zc` Fold the current category section (category view only)
|
||||
`zo` Unfold the current category section (category view only)
|
||||
`zc` Fold the current category section (requires `folding`)
|
||||
`zo` Unfold the current category section (requires `folding`)
|
||||
|
||||
Text objects (operator-pending and visual): ~
|
||||
|
||||
|
|
@ -595,6 +595,7 @@ loads: >lua
|
|||
date_syntax = 'due',
|
||||
recur_syntax = 'rec',
|
||||
someday_date = '9999-12-30',
|
||||
folding = true,
|
||||
category_order = {},
|
||||
keymaps = {
|
||||
close = 'q',
|
||||
|
|
@ -684,6 +685,35 @@ Fields: ~
|
|||
given order. Categories not in the list are appended
|
||||
after the ordered ones in their natural order.
|
||||
|
||||
{folding} (boolean|table, default: true) *pending.FoldingConfig*
|
||||
Controls category-level folds in category view. When
|
||||
`true`, folds are enabled with the default foldtext
|
||||
`'%c (%n tasks)'`. When `false`, folds are disabled
|
||||
entirely. When a table, folds are enabled and the
|
||||
table may contain:
|
||||
|
||||
{foldtext} (string|false, default: '%c (%n tasks)')
|
||||
Custom foldtext format string. Set to
|
||||
`false` to use Vim's built-in
|
||||
foldtext. Two specifiers are
|
||||
available:
|
||||
`%c` category name
|
||||
`%n` number of tasks in the fold
|
||||
The category icon is prepended
|
||||
automatically. When `false`, the
|
||||
default Vim foldtext is used.
|
||||
|
||||
Folds only apply to category view; priority view
|
||||
is always fold-free regardless of this setting.
|
||||
|
||||
Examples: >lua
|
||||
vim.g.pending = { folding = true }
|
||||
vim.g.pending = { folding = false }
|
||||
vim.g.pending = {
|
||||
folding = { foldtext = '%c (%n tasks)' },
|
||||
}
|
||||
<
|
||||
|
||||
{keymaps} (table, default: see below) *pending.Keymaps*
|
||||
Buffer-local key bindings. Each field maps an action
|
||||
name to a key string. Set a field to `false` to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue