The plugin allow you to view, add, edit, and complete tasks without ever leaving the comfort of Neovim text The goals of this plugin are:
Query View
similar to dateview
in Obsidian or Viewport
in Taskwikitaskwiki
or dateview
in Obsidiantask {id} edit
)markdown.nvim
and obsidan.nvim
, you should disable obsidian.nvim
's UI configurationsobsidian.nvim
and mkdnflow.nvim
(due to special filetype vimwiki
){
"huantrinh1802/m_taskwarrior_d.nvim",
version = "*",
dependencies = { "MunifTanjim/nui.nvim" },
config = function()
-- Require
require("m_taskwarrior_d").setup()
-- Optional
vim.api.nvim_set_keymap("n", "<leader>te", "<cmd>TWEditTask<cr>", { desc = "TaskWarrior Edit", noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>tv", "<cmd>TWView<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>tu", "<cmd>TWUpdateCurrent<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<leader>ts", "<cmd>TWSyncTasks<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap(
"n",
"<c-space>",
"<cmd>TWToggle<cr>",
{ silent = true }
)
-- Be caution: it may be slow to open large files, because it scan the whole buffer
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, {
group = vim.api.nvim_create_augroup("TWTask", { clear = true }),
pattern = "*.md,*.markdown", -- Pattern to match Markdown files
callback = function()
vim.cmd('TWSyncTasks')
end,
})
end,
},
{
-- The order of toggling task statuses
task_statuses = { " ", ">", "x", "~" },
-- The mapping between status and symbol in checkbox
status_map = { [" "] = "pending", [">"] = "active", ["x"] = "completed", ["~"] = "deleted" },
-- The checkbox prefix and suffix
checkbox_prefix = "[",
checkbox_suffix = "]",
-- The default list symbol
default_list_symbol = "-",
-- Comments pattern prefix and suffix
-- This is extremely useful for viewing the note in any Makrdown previewers (i.e. Obsidian app) if you set
-- - comment_prefix = "<!--",
-- - comment_suffix = "-->",
comment_prefix = "",
comment_suffix = "",
-- The file pattern to trigger the conceal
file_patterns = { "*.md", "*.markdown" },
display_due_or_scheduled = true
-- More configurations will be added in the future
}
pending
: corresponding to pending
statusactive
: has active
attribute completed
: corresponding to completed
statusdeleted
: corresponding to deleted
statusIf you are using obsidian.nvim
, you can use the following configuration:
{
ui = {
checkboxes = {
[" "] = { char = "", hl_group = "ObsidianTodo" },
["x"] = { char = "", hl_group = "ObsidianDone" },
[">"] = { char = "", hl_group = "ObsidianRightArrow" },
["~"] = { char = "", hl_group = "ObsidianTilde" },
},
hl_groups = {
ObsidianTodo = { bold = true, fg = "#f78c6c" },
ObsidianDone = { bold = true, fg = "#89ddff" },
ObsidianRightArrow = { bold = true, fg = "#f78c6c" },
ObsidianTilde = { bold = true, fg = "#ff5370" },
ObsidianBullet = { bold = true, fg = "#89ddff" },
ObsidianRefText = { underline = true, fg = "#008080" },
ObsidianExtLinkIcon = { fg = "#008080" },
ObsidianTag = { italic = true, fg = "#89ddff" },
ObsidianHighlightText = { bg = "#75662e" },
},
},
}
If you are using markdown.nvim
, you can set the following configuration:
{
"MeanderingProgrammer/markdown.nvim",
name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
require("render-markdown").setup({
checkbox = {
enabled = true,
checked = {
-- Replaces '[x]' of 'task_list_marker_checked'
icon = " ",
-- Highligh for the checked icon
highlight = "RenderMarkdownChecked",
},
custom = {
started = { raw = "[>]", rendered = " ", highlight = "@markup.raw" },
deleted = { raw = "[~]", rendered = " ", highlight = "@markup.raw" },
},
},
})
end,
},
:TWToggle
: toggle status of task
active
.pending
.completed
.deleted
.:TWSyncTasks
: traverse the current buffer and sync all tasks
$id{uuid}
then it will add the task to TaskWarrior and update the UUIDstatus:*
. # Project pending tasks for project A $query{status:pending project:A}
:TWSyncCurrent
: similar to TWSyncTasks
but only sync the current task. Work with normal and visual mode:TWSyncBulk
: similar to TWSyncTasks
but only sync the selected tasks in visual mode:TWUpdateCurrent
: quickly update the description of the task so you don't have to use the edit command:TWEditTask
: toggle a float window, which can edit the task.
task {id} edit
behind the scene:TWView
: a quick view of more details of the task
:TWRunWithCurrent
: extract the current UUID, and ask user for input. Run the command as follow !task {uuid} {user input}
:TWRun
: there are two ways to use this command:
TWRun
without any arguments, an input component will appear and ask for your commandtask
TWRun {command}
task {user input}
add
, del
, mod
or purge
, the output will print out only:TWFocusFloat
: switch the focus to a floating window (or hover, triggered by TWView
, TWRunWithCurrent
, and TWRun
).:TWEditSavedQueries
: display a buffer with list of saved queries. Each query should be a valid Taskwarrior query that can be run with task {query}
[name of the query] | [filters] | [report]
, don't include [
and ]
in your actual queryq
or :q
will close thu buffer without saving any changes:wq
or w
will save and close the buffervim.fn.stdpath("data").."m_taskwarrior_d.nvim"
:TWSavedQueries
: will prompt a menu with the list of all saved queries, after an item is selected, a floating window will open with the output of task {query}
:TWRunBulk
: similar to TWRun
, but run commands on selected tasks in visual mode:TWQueryTasks
: similar to taskwiki
's viewport, render the output of the task {query}
as the list of tasks
:TWBufQueryTasks
: similar to TWQueryTasks
, but this will scan the current buffer and run all the queries in the current buffer:TWTaskScratch
: prompt a menu with the list of all saved queries, after an item is selected, a split window will open and render out the tasks of the selected query
vim.fn.stdpath("data").."/m_taskwarrior_d.md"
, append the selected query and run TWQueryTasks
on it:TWScratchShow
: to show the hidden scratch window:TWScratchHide
: to hide the scratch window:TWShowDueOrScheduled
: display due or scheduled tasks as virtual text end of line:TWShowDueOrScheduledCurrent
: display due or scheduled tasks as virtual text end of line for current line- [ ] Task 1 # Has 1.1, 1.2, 1.2.1 as dependencies $id{d4452942-ac6e-46c6-b110-001ea731c676}
- [ ] Task 1.1 # Has none $id{53389315-5975-4db9-a796-1cd2514e1be1}
- [ ] Task 1.2 # Has 1.2.1 as dependency $id{ea843624-37c0-429c-89c6-19f661149668}
- [ ] Task 1.2.1 $id{792e57a6-ea55-4c9e-ab32-9e840d66088d}
# Tasks that are in pending of project A $query{status:pending project:A}
This plugin is licensed under the MIT License. See the LICENSE file for more details.
If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository.
Thank you for using the Neovim Lua Plugin! If you find it helpful, please consider starring the repository.