* feat(gtasks): add Google Tasks bidirectional sync
Problem: pending.nvim only supported one-way push to Google Calendar.
Users who use Google Tasks had no way to sync tasks bidirectionally.
Solution: add `lua/pending/sync/gtasks.lua` backend with OAuth PKCE
auth, push/pull/sync actions, and field mapping between pending tasks
and Google Tasks (category↔tasklist, `priority`/`recur` via notes).
* refactor(cli): promote sync backends to top-level subcommands
Problem: `:Pending sync gtasks auth` required an extra `sync` keyword
that added no value and made the command unnecessarily verbose.
Solution: route `gtasks` and `gcal` as top-level `:Pending` subcommands
via `SYNC_BACKEND_SET` lookup. Tab completion introspects backend
modules for available actions instead of hardcoding `{ 'auth', 'sync' }`.
* docs(gtasks): document Google Tasks backend and CLI changes
Problem: vimdoc had no coverage for the gtasks backend and still
referenced the old `:Pending sync <backend>` command form.
Solution: add `:Pending-gtasks` and `:Pending-gcal` command sections
with per-action docs, update sync backend interface, and add gtasks
config example.
* ci: format
115 lines
2.6 KiB
Lua
115 lines
2.6 KiB
Lua
---@class pending.Icons
|
|
---@field pending string
|
|
---@field done string
|
|
---@field priority string
|
|
---@field due string
|
|
---@field recur string
|
|
---@field category string
|
|
|
|
---@class pending.GcalConfig
|
|
---@field calendar? string
|
|
---@field credentials_path? string
|
|
|
|
---@class pending.GtasksConfig
|
|
---@field credentials_path? string
|
|
|
|
---@class pending.SyncConfig
|
|
---@field gcal? pending.GcalConfig
|
|
---@field gtasks? pending.GtasksConfig
|
|
|
|
---@class pending.Keymaps
|
|
---@field close? string|false
|
|
---@field toggle? string|false
|
|
---@field view? string|false
|
|
---@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
|
|
---@field i_task? string|false
|
|
---@field a_category? string|false
|
|
---@field i_category? string|false
|
|
---@field next_header? string|false
|
|
---@field prev_header? string|false
|
|
---@field next_task? string|false
|
|
---@field prev_task? string|false
|
|
|
|
---@class pending.Config
|
|
---@field data_path string
|
|
---@field default_view 'category'|'priority'
|
|
---@field default_category string
|
|
---@field date_format string
|
|
---@field date_syntax string
|
|
---@field recur_syntax string
|
|
---@field someday_date string
|
|
---@field category_order? string[]
|
|
---@field drawer_height? integer
|
|
---@field debug? boolean
|
|
---@field keymaps pending.Keymaps
|
|
---@field sync? pending.SyncConfig
|
|
---@field icons pending.Icons
|
|
|
|
---@class pending.config
|
|
local M = {}
|
|
|
|
---@type pending.Config
|
|
local defaults = {
|
|
data_path = vim.fn.stdpath('data') .. '/pending/tasks.json',
|
|
default_view = 'category',
|
|
default_category = 'Todo',
|
|
date_format = '%b %d',
|
|
date_syntax = 'due',
|
|
recur_syntax = 'rec',
|
|
someday_date = '9999-12-30',
|
|
category_order = {},
|
|
keymaps = {
|
|
close = 'q',
|
|
toggle = '<CR>',
|
|
view = '<Tab>',
|
|
priority = '!',
|
|
date = 'D',
|
|
undo = 'U',
|
|
filter = 'F',
|
|
open_line = 'o',
|
|
open_line_above = 'O',
|
|
a_task = 'at',
|
|
i_task = 'it',
|
|
a_category = 'aC',
|
|
i_category = 'iC',
|
|
next_header = ']]',
|
|
prev_header = '[[',
|
|
next_task = ']t',
|
|
prev_task = '[t',
|
|
},
|
|
sync = {},
|
|
icons = {
|
|
pending = ' ',
|
|
done = 'x',
|
|
priority = '!',
|
|
due = '.',
|
|
recur = '~',
|
|
category = '#',
|
|
},
|
|
}
|
|
|
|
---@type pending.Config?
|
|
local _resolved = nil
|
|
|
|
---@return pending.Config
|
|
function M.get()
|
|
if _resolved then
|
|
return _resolved
|
|
end
|
|
local user = vim.g.pending or {}
|
|
_resolved = vim.tbl_deep_extend('force', defaults, user)
|
|
return _resolved
|
|
end
|
|
|
|
---@return nil
|
|
function M.reset()
|
|
_resolved = nil
|
|
end
|
|
|
|
return M
|