A Neovim plugin that helps manage, prioritize, and categorize todo items in your Markdown lists.
- Interactively assign priority numbers to selected task items
- Move tasks between categories with auto-generated shortcuts
- Option to prioritize only unprioritized items or reprioritize everything
- Sort tasks by priority (stable sort within each category)
- Toggle task checkboxes in normal and visual mode
- Checking a task automatically moves it to the bottom of its section
- Works with Markdown lists, bullet points, and numbered lists
- Preserves task hierarchy and sub-items when moving between categories
use {
'hamidzr/task-manager.nvim',
name='task-manager',
config = function()
require('task-manager').setup()
end
}Plug 'hamidzr/task-manager.nvim'Then add to your init.vim or init.lua:
require('task-manager').setup(){
'hamidzr/task-manager.nvim',
name='task-manager',
config = function()
require('task-manager').setup({
-- Optional: customize settings here
debug = true, -- Enable debug mode during development
})
end
}The plugin works with default settings, but you can customize it:
require('task-manager').setup({
-- Format for priority tags: [p1], [p2], etc.
priority_format = "%s [p%d] %s",
-- Regular expression to identify already prioritized items
priority_pattern = "%[p(%d+)%]",
-- Keybindings (without leader)
keybindings = {
prioritize_all = "ta", -- (t)odo (a)ll prioritize
prioritize_new = "tn", -- (t)odo (n)ew prioritize
sort_by_priority = "ts", -- (t)odo (s)ort
toggle_checkbox = "tx", -- (t)odo (x) checkbox toggle
},
-- Category heading pattern (Markdown h2)
category_pattern = "^%s*##%s+(.+)$",
-- Sort selection automatically after triage changes are applied
auto_sort = true,
-- Debug mode (prints additional information)
debug = false
})The keybindings table is merged deeply so partial overrides work:
require('task-manager').setup({
keybindings = {
prioritize_new = "tp" -- Only override one keybinding
}
})The plugin expects your to-do list to be organized with Markdown headings as categories:
## Work
- Fix bug in login form
- [p1] Prepare for meeting
- Update documentation
## Personal
- [p3] Buy groceries
- Call dentist- Select the lines containing your tasks in visual mode
- Use one of the following commands:
<leader>ta- Prioritize all selected items (reprioritize everything)<leader>tn- Prioritize only new items (skip already prioritized items)<leader>ts- Sort selected items by priority (checked items at bottom)<leader>tx- Toggle checkbox state (works in both normal and visual mode)
When you initiate prioritization:
- The plugin will display a table of categories and their auto-generated shortcuts
- For each line, you'll be prompted to:
- Enter a number (1-9) to set a priority
- Press
0to clear an existing priority - Enter a category shortcut to move the task to another category
- Press 's' to skip the current item
- Press 'q' to quit the process
- If you quit with pending changes:
- You'll be prompted to apply or discard the changes
- Changes include both priority updates and category moves
- All changes are applied atomically (all or nothing)
- When
auto_sortis enabled (default), the selection is sorted by priority after changes are applied
The sort command (ts) organizes tasks with the following rules:
- Tasks are sorted within their respective categories
- Checked items (
[x]) are moved to the bottom of their category - Unchecked items are sorted by priority (1-9)
- Items without priorities maintain their relative order
- Sub-items (indented tasks) stay with their parent items
- Category headings remain at the top of their sections
Starting with:
## Work
- [x] Fix bug in login form
- [p1] Prepare for meeting
- [x] Review agenda
- [p2] Prepare slides
## Personal
- Buy groceries
- [p3] Call dentistAfter sorting (ts):
## Work
- [p1] Prepare for meeting
- [x] Review agenda
- [p2] Prepare slides
- [x] Fix bug in login form
## Personal
- [p3] Call dentist
- Buy groceriesNote: When sorting tasks by priority (ts), checked items ([x]) are automatically moved to the bottom of their respective categories, regardless of their priority.
The plugin provides a convenient way to toggle task checkboxes:
- In normal mode: Place your cursor on a task line and press
<leader>txto toggle its checkbox state - In visual mode: Select multiple task lines and press
<leader>txto toggle all selected checkboxes
If a line doesn't have a checkbox, pressing <leader>tx will add one in the checked state ([x]).
When you toggle a checkbox from unchecked ([ ]) to checked ([x]), the task is automatically moved to the bottom of its current heading section — the content under the nearest heading above, stopping before the next heading of any level. Nested subsections are not skipped: a task under ## Work that sits above ### Meeting moves to just before that ###, not past all nested headings. A task under ### Meeting stays within that subsection. Sub-items and nested list siblings are unchanged. The moved task lands right after the section's last non-blank line, with one blank line separating open items from the checked cluster (an existing blank is reused, and none is added directly under a heading).
Run the regression harness with:
nvim --headless --clean -u NONE -U NONE -n -l tests/run.luaThe suite validates parsing, category moves, sorting, checkbox handling, and configuration overrides.
Place the plugin in your Neovim configuration directory:
~/.config/nvim/lua/task-manager.lua
Or if you're packaging it as a proper plugin:
~/.config/nvim/
├── lua/
└── task-manager/
├── init.lua
└── README.md
- remove priorities
- tx to also work in visual mode and over many lines
- ts and ta to ignore [x] items. sort at the bottom
- highlight the same lines (or reduced set because of the moves) after changes
- should work on a list that's nested if only l1 lists are selected only operate on thoese. neesd more thinking