a ver si ahora respeta los espacios

main
borja 1 year ago
parent ac03e408f8
commit 4eb596e405

@ -58,11 +58,19 @@ local function add_todo()
local line = vim.api.nvim_get_current_line() local line = vim.api.nvim_get_current_line()
local i, spaces = string.find(line, "^%s*") local i, spaces = string.find(line, "^%s*")
print(i, spaces)
-- if not string.match(line, openpattern) and not string.match(line, closedpattern) then if not string.match(line, openpattern) and not string.match(line, closedpattern) then
-- line = spaces .. "- [ ] " .. line if i == 1 and spaces == 0 then
-- vim.api.nvim_set_current_line(line) 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 -- if not string.sub(line, 1, 1) == " " then
-- line = "- [ ] " .. line -- line = "- [ ] " .. line
-- vim.api.nvim_set_current_line(line) -- vim.api.nvim_set_current_line(line)

Loading…
Cancel
Save