tab y shift tab

main
borja 1 year ago
parent 7a19758eb6
commit 82cafd0c8f

@ -38,10 +38,26 @@ 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(">", "n", true)
vim.api.nvim_feedkeys(">", "n", true)
end
end
vim.keymap.set("n", "<TAB>", 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()
local current_line = vim.api.nvim_get_current_line()
-- Check if current line matches the patterns
local openpattern = "%- %[[ ]%]"
local closedpattern = "%- %[[x]%]"
if string.match(current_line, openpattern) or string.match(current_line, closedpattern) then
print("shift tab pressed, allegedly")
vim.api.nvim_feedkeys("<", "n", true)
vim.api.nvim_feedkeys("<", "n", true)
end
end
vim.keymap.set("n", "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()

Loading…
Cancel
Save