From 28d6af114c294facd7fe7025b157d36126a42002 Mon Sep 17 00:00:00 2001 From: borja Date: Mon, 27 Nov 2023 23:55:46 +0100 Subject: [PATCH] =?UTF-8?q?ahora=20apa=C3=B1a=20el=20remove=20todo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/todoer.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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, "")