Problem: :Pending|only failed because the command definition lacked the bar attribute, causing | to be consumed as an argument. Solution: Add bar = true to nvim_create_user_command so | is treated as a command separator, matching fugitive's :Git behavior.
56 lines
1.4 KiB
Lua
56 lines
1.4 KiB
Lua
if vim.g.loaded_pending then
|
|
return
|
|
end
|
|
vim.g.loaded_pending = true
|
|
|
|
vim.api.nvim_create_user_command('Pending', function(opts)
|
|
require('pending').command(opts.args)
|
|
end, {
|
|
bar = true,
|
|
nargs = '*',
|
|
complete = function(arg_lead, cmd_line)
|
|
local subcmds = { 'add', 'sync', 'archive', 'due', 'undo' }
|
|
if not cmd_line:match('^Pending%s+%S') then
|
|
return vim.tbl_filter(function(s)
|
|
return s:find(arg_lead, 1, true) == 1
|
|
end, subcmds)
|
|
end
|
|
return {}
|
|
end,
|
|
})
|
|
|
|
vim.keymap.set('n', '<Plug>(pending-open)', function()
|
|
require('pending').open()
|
|
end)
|
|
|
|
vim.keymap.set('n', '<Plug>(pending-close)', function()
|
|
require('pending.buffer').close()
|
|
end)
|
|
|
|
vim.keymap.set('n', '<Plug>(pending-toggle)', function()
|
|
require('pending').toggle_complete()
|
|
end)
|
|
|
|
vim.keymap.set('n', '<Plug>(pending-view)', function()
|
|
require('pending.buffer').toggle_view()
|
|
end)
|
|
|
|
vim.keymap.set('n', '<Plug>(pending-priority)', function()
|
|
require('pending').toggle_priority()
|
|
end)
|
|
|
|
vim.keymap.set('n', '<Plug>(pending-date)', function()
|
|
require('pending').prompt_date()
|
|
end)
|
|
|
|
vim.keymap.set('n', '<Plug>(pending-undo)', function()
|
|
require('pending').undo_write()
|
|
end)
|
|
|
|
vim.keymap.set('n', '<Plug>(pending-open-line)', function()
|
|
require('pending.buffer').open_line(false)
|
|
end)
|
|
|
|
vim.keymap.set('n', '<Plug>(pending-open-line-above)', function()
|
|
require('pending.buffer').open_line(true)
|
|
end)
|