From 1fa6f9048c1dcbd42decc5d15e96eaccbad03de9 Mon Sep 17 00:00:00 2001 From: borja Date: Tue, 28 Nov 2023 00:12:44 +0100 Subject: [PATCH] =?UTF-8?q?devuelve=20al=20fin=20de=20l=C3=ADnea=20cuando?= =?UTF-8?q?=20se=20crea=20todo=20vac=C3=ADo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/todoer.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin/todoer.lua b/plugin/todoer.lua index f6bcabb..0d0827b 100644 --- a/plugin/todoer.lua +++ b/plugin/todoer.lua @@ -4,6 +4,8 @@ vim.keymap.set("n", "t", function() end, { desc = "+Todos" }) local function press_enter() local current_line = vim.api.nvim_get_current_line() + local index, spaces = string.find(current_line, "^%s*") + -- Check if the current line matches the pattern local pattern = "^%- %[[ x]%] .*$" local match = string.match(current_line, pattern) @@ -63,6 +65,7 @@ local function add_todo() if index == 1 and spaces == 0 then line = "- [ ] " .. line vim.api.nvim_set_current_line(line) + vim.api.nvim_feedkeys("A", "n", true) elseif index == 1 and spaces > 0 then local trimedline = string.sub(line, spaces + 1) local spacestring = ""