fix(buffer): replace indentexpr with dedicated o/O mappings
Problem: setup_indentexpr always returned 0 because no task line starts with whitespace (the /ID/ prefix begins with /), so the return 2 branch was dead code. Pressing o or O opened a blank line at column 0 with no ID prefix, which the diff parser cannot recognise as a task. Solution: remove setup_indentexpr and M.get_indent() entirely; add M.open_line(above) which inserts a two-space stub line and enters insert mode at the end so the user types directly into the new task body. The diff layer already handles lines matching ^ .+ as new tasks. Add o and O buffer-local mappings in init.lua.
This commit is contained in:
parent
d2c9eb1808
commit
3919e3f88f
2 changed files with 17 additions and 15 deletions
|
|
@ -61,6 +61,12 @@ function M._setup_buf_mappings(bufnr)
|
|||
vim.keymap.set('n', 'U', function()
|
||||
M.undo_write()
|
||||
end, opts)
|
||||
vim.keymap.set('n', 'o', function()
|
||||
buffer.open_line(false)
|
||||
end, opts)
|
||||
vim.keymap.set('n', 'O', function()
|
||||
buffer.open_line(true)
|
||||
end, opts)
|
||||
end
|
||||
|
||||
---@param bufnr integer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue