nuevas pattern

main
borja 1 year ago
parent ee6ddbdf4a
commit 5ef2af6f6d

@ -78,14 +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
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, "")

Loading…
Cancel
Save