Auto sync: 2025-09-09 13:53:47 (3 files changed)
M lazy-lock.json M lua/custom/init.lua A lua/custom/taskwarrior.lua
This commit is contained in:
parent
ba34fc82a5
commit
77a898a3cd
@ -1,38 +1,38 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
||||
"auto-session": { "branch": "main", "commit": "0a1318557c03845f2e0dde347bc54507d1d8c34d" },
|
||||
"LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" },
|
||||
"auto-session": { "branch": "main", "commit": "3b5d8947cf16ac582ef00443ede4cdd3dfa23af9" },
|
||||
"base46": { "branch": "v2.0", "commit": "85de6cdb2d3c85d0aee53aea0569e73fdaf3df4e" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "b1a75324ddf96b7bb84963a297b1ed334db087c0" },
|
||||
"crates.nvim": { "branch": "main", "commit": "fd2bbca7aa588f24ffc3517831934b4c4a9588e9" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "3c76f7fabac723aa682365ef782f88a83ccdb4ac" },
|
||||
"conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" },
|
||||
"crates.nvim": { "branch": "main", "commit": "ac9fa498a9edb96dc3056724ff69d5f40b898453" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "b7aa0aed55887edfaece23f7b46ab22232fc8741" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
|
||||
"nabla.nvim": { "branch": "master", "commit": "9b69b709063ccf40ac36fabb4fff7d90b3736475" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "84a81a7d1f28b381b32acf1e8fe5ff5bef4f7968" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "059e89495b3ec09395262f16b1ad441a38081d04" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
|
||||
"nvim-dap": { "branch": "master", "commit": "7aade9e99bef5f0735cf966e715b3ce45515d786" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "40f120c10ea4b87311175539a183c3b75eab95a3" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "44d9b58f11d5a426c297aafd0be1c9d45617a849" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "997288c55253e27f782d991099490f80205d65bf" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "51cf7c995ed1eb6642aecf19067ee634fa1b6ba2" },
|
||||
"nvim-dap": { "branch": "master", "commit": "7891b01beedc37cef4eaf2e92563bd0a5b6e9c58" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a3deebbd110016f50cc66b7b256120072f3804db" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "fefa335f1c8f690eb668a1efd18ee4fc6d64cd3e" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "f66cdfef5e84112045b9ebc3119fee9bddb3c687" },
|
||||
"nvterm": { "branch": "main", "commit": "9d7ba3b6e368243175d38e1ec956e0476fd86ed9" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
|
||||
"tla.nvim": { "branch": "master", "commit": "1db3e7558066b89c391d20dbc99972023a176491" },
|
||||
"ui": { "branch": "v2.0", "commit": "7b3225264af17a9e0aff0b4fd2a0fac90b73db53" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"tla.nvim": { "branch": "master", "commit": "1752abe9b7dec23a26ff11a629e2ee88e66c366b" },
|
||||
"ui": { "branch": "v2.0", "commit": "d4f7e64892a24075d5fdd5a58bd0db45e86e38ed" },
|
||||
"vim-tla": { "branch": "master", "commit": "220145ef791ac8d64d2c319eb2940b59da17d6ca" },
|
||||
"vimtex": { "branch": "master", "commit": "c74d9927d9ac2fd24f965634ab56fc5d3c0a60a7" },
|
||||
"vimtex": { "branch": "master", "commit": "dc90feacb86f7b85b0b791d8073eefc769a23725" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
|
||||
@ -8,4 +8,5 @@ vim.keymap.set("i", "jj", "<ESC>")
|
||||
require "custom.zk"
|
||||
require "custom.git_quickpush"
|
||||
require "custom.journal"
|
||||
require "custom.taskwarrior"
|
||||
print "Custom init settings loaded."
|
||||
|
||||
154
lua/custom/taskwarrior.lua
Normal file
154
lua/custom/taskwarrior.lua
Normal file
@ -0,0 +1,154 @@
|
||||
-- Taskwarrior integration for Neovim
|
||||
-- Add this to your ~/.config/nvim/init.lua or create a separate plugin file
|
||||
|
||||
-- Basic task management commands
|
||||
vim.api.nvim_create_user_command("TaskAdd", function(opts)
|
||||
local task_desc = opts.args
|
||||
if task_desc == "" then
|
||||
task_desc = vim.fn.input "Task description: "
|
||||
end
|
||||
vim.fn.system("task add " .. vim.fn.shellescape(task_desc))
|
||||
print("Task added: " .. task_desc)
|
||||
end, { nargs = "*", desc = "Add a new task" })
|
||||
|
||||
vim.api.nvim_create_user_command("TaskList", function()
|
||||
local output = vim.fn.system "task list"
|
||||
vim.cmd "new"
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, false, vim.split(output, "\n"))
|
||||
vim.bo.buftype = "nofile"
|
||||
vim.bo.bufhidden = "wipe"
|
||||
vim.bo.modifiable = false
|
||||
vim.wo.number = false
|
||||
vim.wo.relativenumber = false
|
||||
end, { desc = "Show task list in new buffer" })
|
||||
|
||||
vim.api.nvim_create_user_command("TaskNext", function()
|
||||
local output = vim.fn.system "task next"
|
||||
print(vim.trim(output))
|
||||
end, { desc = "Show next tasks" })
|
||||
|
||||
vim.api.nvim_create_user_command("TaskEdit", function(opts)
|
||||
local task_id = opts.args
|
||||
if task_id == "" then
|
||||
task_id = vim.fn.input "Task ID to edit: "
|
||||
end
|
||||
if task_id ~= "" then
|
||||
vim.fn.system("task " .. task_id .. " edit")
|
||||
print("Edited task " .. task_id)
|
||||
end
|
||||
end, { nargs = "?", desc = "Edit a task by ID" })
|
||||
|
||||
vim.api.nvim_create_user_command("TaskDone", function(opts)
|
||||
local task_id = opts.args
|
||||
if task_id == "" then
|
||||
task_id = vim.fn.input "Task ID to complete: "
|
||||
end
|
||||
if task_id ~= "" then
|
||||
vim.fn.system("task " .. task_id .. " done")
|
||||
print("Task " .. task_id .. " completed!")
|
||||
end
|
||||
end, { nargs = "?", desc = "Mark task as done" })
|
||||
|
||||
vim.api.nvim_create_user_command("TaskModify", function(opts)
|
||||
local args = vim.split(opts.args, " ", { trimempty = true })
|
||||
if #args < 2 then
|
||||
local task_id = vim.fn.input "Task ID: "
|
||||
local modification = vim.fn.input "Modification (e.g., 'priority:H', '+urgent'): "
|
||||
if task_id ~= "" and modification ~= "" then
|
||||
vim.fn.system("task " .. task_id .. " modify " .. modification)
|
||||
print("Modified task " .. task_id)
|
||||
end
|
||||
else
|
||||
local task_id = args[1]
|
||||
local modification = table.concat(args, " ", 2)
|
||||
vim.fn.system("task " .. task_id .. " modify " .. modification)
|
||||
print("Modified task " .. task_id .. " with: " .. modification)
|
||||
end
|
||||
end, { nargs = "*", desc = "Modify a task" })
|
||||
|
||||
-- Project and context commands
|
||||
vim.api.nvim_create_user_command("TaskProject", function(opts)
|
||||
local project = opts.args
|
||||
if project == "" then
|
||||
local output = vim.fn.system "task projects"
|
||||
print(output)
|
||||
else
|
||||
local output = vim.fn.system("task project:" .. project .. " list")
|
||||
vim.cmd "new"
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, false, vim.split(output, "\n"))
|
||||
vim.bo.buftype = "nofile"
|
||||
vim.bo.bufhidden = "wipe"
|
||||
vim.bo.modifiable = false
|
||||
end
|
||||
end, { nargs = "?", desc = "Show projects or filter by project" })
|
||||
|
||||
-- Advanced: Add task from visual selection
|
||||
vim.keymap.set("v", "<leader>ta", function()
|
||||
local start_pos = vim.fn.getpos "'<"
|
||||
local end_pos = vim.fn.getpos "'>"
|
||||
local lines = vim.api.nvim_buf_get_lines(0, start_pos[2] - 1, end_pos[2], false)
|
||||
local selected_text = table.concat(lines, " "):gsub("%s+", " ")
|
||||
vim.fn.system("task add " .. vim.fn.shellescape(selected_text))
|
||||
print("Task added from selection: " .. selected_text)
|
||||
end, { desc = "Add task from visual selection" })
|
||||
|
||||
-- Key mappings (using <leader>t prefix for taskwarrior)
|
||||
vim.keymap.set("n", "<leader>ta", ":TaskAdd<CR>", { desc = "Add task" })
|
||||
vim.keymap.set("n", "<leader>tl", ":TaskList<CR>", { desc = "List tasks" })
|
||||
vim.keymap.set("n", "<leader>tn", ":TaskNext<CR>", { desc = "Show next tasks" })
|
||||
vim.keymap.set("n", "<leader>te", ":TaskEdit<CR>", { desc = "Edit task" })
|
||||
vim.keymap.set("n", "<leader>td", ":TaskDone<CR>", { desc = "Mark task done" })
|
||||
vim.keymap.set("n", "<leader>tm", ":TaskModify<CR>", { desc = "Modify task" })
|
||||
vim.keymap.set("n", "<leader>tp", ":TaskProject<CR>", { desc = "Show projects" })
|
||||
|
||||
-- Quick shortcuts for common modifications
|
||||
vim.keymap.set("n", "<leader>tH", function()
|
||||
local task_id = vim.fn.input "Task ID for high priority: "
|
||||
if task_id ~= "" then
|
||||
vim.fn.system("task " .. task_id .. " modify priority:H")
|
||||
print("Set task " .. task_id .. " to high priority")
|
||||
end
|
||||
end, { desc = "Set task to high priority" })
|
||||
|
||||
vim.keymap.set("n", "<leader>tu", function()
|
||||
local task_id = vim.fn.input "Task ID to add urgent tag: "
|
||||
if task_id ~= "" then
|
||||
vim.fn.system("task " .. task_id .. " modify +urgent")
|
||||
print("Added urgent tag to task " .. task_id)
|
||||
end
|
||||
end, { desc = "Add urgent tag to task" })
|
||||
|
||||
-- Show task summary in statusline or floating window
|
||||
vim.api.nvim_create_user_command("TaskSummary", function()
|
||||
local output = vim.fn.system "task summary"
|
||||
local lines = vim.split(output, "\n")
|
||||
|
||||
-- Create floating window
|
||||
local width = 60
|
||||
local height = #lines + 2
|
||||
local row = math.floor((vim.o.lines - height) / 2)
|
||||
local col = math.floor((vim.o.columns - width) / 2)
|
||||
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
|
||||
|
||||
local opts = {
|
||||
relative = "editor",
|
||||
width = width,
|
||||
height = height,
|
||||
row = row,
|
||||
col = col,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
title = " Task Summary ",
|
||||
title_pos = "center",
|
||||
}
|
||||
|
||||
vim.api.nvim_open_win(buf, true, opts)
|
||||
vim.bo[buf].modifiable = false
|
||||
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = buf })
|
||||
end, { desc = "Show task summary in floating window" })
|
||||
|
||||
vim.keymap.set("n", "<leader>ts", ":TaskSummary<CR>", { desc = "Show task summary" })
|
||||
|
||||
print "Taskwarrior integration loaded! Use <leader>t* commands or :Task* commands"
|
||||
Loading…
x
Reference in New Issue
Block a user