|
|
@ -78,9 +78,12 @@ vim.keymap.set("n", "<leader>ta", add_todo, { desc = "Add todo" })
|
|
|
|
|
|
|
|
|
|
|
|
-- function that checks if the current line starts with the string "- [ ]" or "- [x]" and, if it does, removes that string from the line
|
|
|
|
-- function that checks if the current line starts with the string "- [ ]" or "- [x]" and, if it does, removes that string from the line
|
|
|
|
local function remove_todo()
|
|
|
|
local function remove_todo()
|
|
|
|
local openpattern = "^%s*%- %[[ ]%]"
|
|
|
|
-- local openpattern = "^%s*%- %[[ ]%]"
|
|
|
|
local closedpattern = "^%s*%- %[[x]%]"
|
|
|
|
-- local closedpattern = "^%s*%- %[[x]%]"
|
|
|
|
|
|
|
|
local openpattern = "- [ ] "
|
|
|
|
|
|
|
|
local closedpattern = "- [x] "
|
|
|
|
local line = vim.api.nvim_get_current_line()
|
|
|
|
local line = vim.api.nvim_get_current_line()
|
|
|
|
|
|
|
|
local index, spaces = string.find(line, "^%s*")
|
|
|
|
|
|
|
|
|
|
|
|
if string.match(line, openpattern) or string.match(line, closedpattern) then
|
|
|
|
if string.match(line, openpattern) or string.match(line, closedpattern) then
|
|
|
|
line = string.gsub(line, openpattern, "")
|
|
|
|
line = string.gsub(line, openpattern, "")
|
|
|
|