|
|
|
@ -58,11 +58,19 @@ local function add_todo()
|
|
|
|
|
|
|
|
|
|
local line = vim.api.nvim_get_current_line()
|
|
|
|
|
local i, spaces = string.find(line, "^%s*")
|
|
|
|
|
print(i, spaces)
|
|
|
|
|
|
|
|
|
|
-- if not string.match(line, openpattern) and not string.match(line, closedpattern) then
|
|
|
|
|
-- line = spaces .. "- [ ] " .. line
|
|
|
|
|
-- vim.api.nvim_set_current_line(line)
|
|
|
|
|
if not string.match(line, openpattern) and not string.match(line, closedpattern) then
|
|
|
|
|
if i == 1 and spaces == 0 then
|
|
|
|
|
line = spaces .. "- [ ] " .. line
|
|
|
|
|
vim.api.nvim_set_current_line(line)
|
|
|
|
|
elseif i == 1 and spaces ~= 0 then
|
|
|
|
|
local spacestring = ""
|
|
|
|
|
for x = 1, spaces do
|
|
|
|
|
spacestring = spacestring .. " "
|
|
|
|
|
end
|
|
|
|
|
line = spacestring .. "- [ ] " .. line
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- if not string.sub(line, 1, 1) == " " then
|
|
|
|
|
-- line = "- [ ] " .. line
|
|
|
|
|
-- vim.api.nvim_set_current_line(line)
|
|
|
|
|