From bb1e89dae2924abf4ed2b33926c09755cd7f58ce Mon Sep 17 00:00:00 2001 From: borja Date: Sun, 26 Nov 2023 23:17:43 +0100 Subject: [PATCH] =?UTF-8?q?quito=20los=20print=20pero=20sigo=20sin=20saber?= =?UTF-8?q?=20por=20qu=C3=A9=20no=20est=C3=A1=20usando=20mi=20funci=C3=B3n?= =?UTF-8?q?=20en=20enter=20pero=20s=C3=AD=20acepta=20el=20resto=20de=20key?= =?UTF-8?q?maps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/todoer.lua | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugin/todoer.lua b/plugin/todoer.lua index 3ca4626..c881c5a 100644 --- a/plugin/todoer.lua +++ b/plugin/todoer.lua @@ -1,12 +1,9 @@ -print("primer keymap") - vim.keymap.set("n", "t", function() end, { desc = "+Todos" }) -- add new todo line when previous is already a todo -local function on_enter() +local function press_enter() local current_line = vim.api.nvim_get_current_line() - print("entro en onenter") -- Check if the current line matches the pattern local pattern = "^%- %[[ x]%] .*$" local match = string.match(current_line, pattern) @@ -26,9 +23,7 @@ local function on_enter() vim.api.nvim_feedkeys("\n", "n", true) end end -vim.keymap.set("i", "", on_enter, { desc = "On enter", noremap = false, expr = true }) - -print("segundo keymap") +vim.keymap.set("i", "", press_enter, { desc = "On enter", noremap = true, expr = true }) -- function that checks if the current line starts with the string "- [ ]" or "- [x]" and toggles the x local function toggle_todo() @@ -53,7 +48,6 @@ local function toggle_todo() end vim.keymap.set("n", "tt", toggle_todo, { desc = "Toggle todo" }) -print("tercero") -- function that checks if the current line doesn't start with the string "- [ ] " and, if it doesn't, adds the string at the beginning of the line local function add_todo() local line = vim.api.nvim_get_current_line()