Skip to content

Commit

Permalink
NeoVim: Wire in own cli tool, basic functionalities
Browse files Browse the repository at this point in the history
- Add
- List
  • Loading branch information
ducktordanny committed Mar 12, 2024
1 parent d06789a commit 0471f4d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/nvim/lua/ducktordanny/custom/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
local worktree = require "ducktordanny.custom.worktree"
local td = require "ducktordanny.custom.td"

vim.keymap.set("n", "<leader>si", worktree.select_worktree_dropdown, { desc = "Select work tree" })
vim.keymap.set("n", "<leader>td", function()
td.add_local_todo "alma"
end)
vim.api.nvim_create_user_command("TdAdd", td.add_local_todo, {})
vim.api.nvim_create_user_command("TdListUnresolved", td.show_unresolved_todos, {})
16 changes: 16 additions & 0 deletions config/nvim/lua/ducktordanny/custom/td.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local M = {}

M.add_local_todo = function(command)
if command.args ~= nil and command.args ~= "" then
vim.fn.system("td -a -c " .. command.args)
print "Done."
else
vim.health.report_error "Missing arguments content for TODO."
end
end

M.show_unresolved_todos = function()
vim.cmd ":!td -ls-urs"
end

return M
3 changes: 3 additions & 0 deletions config/nvim/lua/ducktordanny/plugins/jest.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
return {
"ducktordanny/jest.nvim",
config = function()
vim.keymap.set("n", "<leader>jf", "<cmd>JestFile<cr>", { desc = "Run this test file with Jest" })
end,
}

0 comments on commit 0471f4d

Please sign in to comment.