|
|
@ -38,10 +38,26 @@ local function press_tab()
|
|
|
|
if string.match(current_line, openpattern) or string.match(current_line, closedpattern) then
|
|
|
|
if string.match(current_line, openpattern) or string.match(current_line, closedpattern) then
|
|
|
|
print("tab pressed, allegedly")
|
|
|
|
print("tab pressed, allegedly")
|
|
|
|
vim.api.nvim_feedkeys(">", "n", true)
|
|
|
|
vim.api.nvim_feedkeys(">", "n", true)
|
|
|
|
|
|
|
|
vim.api.nvim_feedkeys(">", "n", true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
vim.keymap.set("n", "<TAB>", press_tab, { desc = "On tab", noremap = true, expr = true })
|
|
|
|
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
|
|
|
|
-- function that checks if the current line starts with the string "- [ ]" or "- [x]" and toggles the x
|
|
|
|
|
|
|
|
|
|
|
|
local function toggle_todo()
|
|
|
|
local function toggle_todo()
|
|
|
|