From 71e37876e9f25e4c14b4930cee3ea6fa0e93dc40 Mon Sep 17 00:00:00 2001 From: borja Date: Mon, 27 Nov 2023 19:05:26 +0100 Subject: [PATCH] mejores patterns para titulos --- plugin/todoer.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugin/todoer.lua b/plugin/todoer.lua index 05e3666..0510f91 100644 --- a/plugin/todoer.lua +++ b/plugin/todoer.lua @@ -28,17 +28,14 @@ vim.keymap.set("i", "", press_enter, { desc = "On enter", noremap = true, ex -- function that checks if the current line starts with the string "- [ ]" or "- [x]" and toggles the x local function toggle_todo() - -- create a variable called openpattern with a pattern that matches a string that starts with any amount of spaces or tabs followed by "- [ ]" local openpattern = "^%s*%- %[[ ]%]" - -- create a variable called closepattern with a pattern that matches a string that starts with any amount of spaces or tabs followed by "- [x]" local closedpattern = "^%s*%- %[[x]%]" - -- create a variable called titleopenpattern with a pattern that matches a string that starts with "# [ ]" - local titleopenpattern = "^# [ ] " + local titleopenpattern = "^%s*# %[[ ]%]" -- create a variable called titleclosedpattern with a pattern that matches a string that starts with "# [x]" - local titleclosedpattern = "^# [x] " + local titleclosedpattern = "^%s*# %[[x]%]" local line = vim.api.nvim_get_current_line()