diff --git a/plugin/todoer.lua b/plugin/todoer.lua index f5fe3f4..11c131b 100644 --- a/plugin/todoer.lua +++ b/plugin/todoer.lua @@ -64,22 +64,15 @@ local function add_todo() line = "- [ ] " .. line vim.api.nvim_set_current_line(line) elseif index == 1 and spaces > 0 then + local trimedline = string.sub(line, spaces + 1) local spacestring = "" for x = 1, spaces, 1 do spacestring = spacestring .. " " end - line = spacestring .. "- [ ] " .. line + line = spacestring .. "- [ ] " .. trimedline vim.api.nvim_set_current_line(line) end end - -- if not string.sub(line, 1, 1) == " " then - -- line = "- [ ] " .. line - -- vim.api.nvim_set_current_line(line) - -- else - -- line = "- [ ]" .. line - -- vim.api.nvim_set_current_line(line) - -- end - -- end end vim.keymap.set("n", "ta", add_todo, { desc = "Add todo" })