devuelve al fin de línea cuando se crea todo vacío

main
borja 1 year ago
parent 5ef2af6f6d
commit 1fa6f9048c

@ -4,6 +4,8 @@ vim.keymap.set("n", "<leader>t", function() end, { desc = "+Todos" })
local function press_enter() local function press_enter()
local current_line = vim.api.nvim_get_current_line() local current_line = vim.api.nvim_get_current_line()
local index, spaces = string.find(current_line, "^%s*")
-- Check if the current line matches the pattern -- Check if the current line matches the pattern
local pattern = "^%- %[[ x]%] .*$" local pattern = "^%- %[[ x]%] .*$"
local match = string.match(current_line, pattern) local match = string.match(current_line, pattern)
@ -63,6 +65,7 @@ local function add_todo()
if index == 1 and spaces == 0 then if index == 1 and spaces == 0 then
line = "- [ ] " .. line line = "- [ ] " .. line
vim.api.nvim_set_current_line(line) vim.api.nvim_set_current_line(line)
vim.api.nvim_feedkeys("A", "n", true)
elseif index == 1 and spaces > 0 then elseif index == 1 and spaces > 0 then
local trimedline = string.sub(line, spaces + 1) local trimedline = string.sub(line, spaces + 1)
local spacestring = "" local spacestring = ""

Loading…
Cancel
Save