diff --git a/plugin/todoer.lua b/plugin/todoer.lua index 7eb210e..f6bcabb 100644 --- a/plugin/todoer.lua +++ b/plugin/todoer.lua @@ -78,14 +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 = "- [ ] " - local closedpattern = "- [x] " + local openpattern = "%- %[[ ]%]" + local closedpattern = "%- %[[x]%]" local line = vim.api.nvim_get_current_line() - local index, spaces = string.find(line, "^%s*") + -- local index, spaces = string.find(line, "^%s*") - if string.find(line, openpattern) or string.find(line, closedpattern) then + if string.match(line, openpattern) or string.match(line, closedpattern) then print("encontrado") line = string.gsub(line, openpattern, "") line = string.gsub(line, closedpattern, "")