Problem: syntax patterns matched the old indent/[N] format; right_align virtual text produced a broken layout in narrow windows; the done strikethrough skipped past the ' ' indent leaving '- [x] ' unstyled; render() added undo history entries so 'u' could undo a re-render. Solution: update taskHeader/taskLine patterns for '## '/'- [.]'; rename taskPriority -> taskCheckbox matching '[!]'; switch virt_text_pos to 'eol'; drop the +2 col_start offset so strikethrough covers '- [x] '; guard nvim_buf_set_lines with undolevels=-1 so renders are not undoable. Also fix open_line to insert '- [ ] ' and position cursor at col 6.
14 lines
446 B
VimL
14 lines
446 B
VimL
if exists('b:current_syntax')
|
|
finish
|
|
endif
|
|
|
|
syntax match taskId /^\/\d\+\// conceal
|
|
syntax match taskHeader /^## .*$/ contains=taskId
|
|
syntax match taskCheckbox /\[!\]/ contained containedin=taskLine
|
|
syntax match taskLine /^\/\d\+\/- \[.\] .*$/ contains=taskId,taskCheckbox
|
|
|
|
highlight default link taskHeader PendingHeader
|
|
highlight default link taskCheckbox PendingPriority
|
|
highlight default link taskLine Normal
|
|
|
|
let b:current_syntax = 'task'
|