diff --git a/plugin/todoer.lua b/plugin/todoer.lua index 11c131b..9f25975 100644 --- a/plugin/todoer.lua +++ b/plugin/todoer.lua @@ -78,9 +78,12 @@ vim.keymap.set("n", "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 local function remove_todo() - local openpattern = "^%s*%- %[[ ]%]" - local closedpattern = "^%s*%- %[[x]%]" + -- local openpattern = "^%s*%- %[[ ]%]" + -- local closedpattern = "^%s*%- %[[x]%]" + local openpattern = "- [ ] " + local closedpattern = "- [x] " 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 line = string.gsub(line, openpattern, "")