From ad8ec54d1084633d8d8665b71c518cb41c58e8c0 Mon Sep 17 00:00:00 2001 From: borja Date: Tue, 5 Dec 2023 09:28:54 +0100 Subject: [PATCH] a ver si ahora --- plugin/todoer.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/todoer.lua b/plugin/todoer.lua index bd0e5f0..f832cec 100644 --- a/plugin/todoer.lua +++ b/plugin/todoer.lua @@ -37,11 +37,13 @@ local function press_tab() if string.match(current_line, openpattern) or string.match(current_line, closedpattern) then print("tab pressed, allegedly") + vim.api.nvim_feedkeys(vim.api.nvim_eval('"\\"'), "n", true) vim.api.nvim_feedkeys(">", "n", true) vim.api.nvim_feedkeys(">", "n", true) + vim.api.nvim_feedkeys("A", "n", true) end end -vim.keymap.set("n", "", press_tab, { desc = "On tab", noremap = true, expr = true }) +vim.keymap.set("i", "", press_tab, { desc = "On tab", noremap = true, expr = true }) -- indent line if shift tab is pressed when line is a todo local function press_shift_tab() @@ -53,11 +55,13 @@ local function press_shift_tab() if string.match(current_line, openpattern) or string.match(current_line, closedpattern) then print("shift tab pressed, allegedly") + vim.api.nvim_feedkeys(vim.api.nvim_eval('"\\"'), "n", true) vim.api.nvim_feedkeys("<", "n", true) vim.api.nvim_feedkeys("<", "n", true) + vim.api.nvim_feedkeys("A", "n", true) end end -vim.keymap.set("n", "S-", press_shift_tab, { desc = "On shift tab", noremap = true, expr = true }) +vim.keymap.set("i", "S-Tab", press_shift_tab, { desc = "On shift tab", 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()