refactor(icons): unify category/header icon and use checkbox overlays
Problem: `header` and `category` were separate icons for the same concept. The icon overlay replaced `[ ]` with a bare character, hiding the markdown checkbox syntax. Header format `## ` produced a double-space with single-char icons. Solution: merge `header` into `category` (one icon for both header lines and EOL labels). Overlay renders `[icon]` preserving bracket syntax. Change header line format from `## ` to `# ` so the 2-char overlay (`# `) maps cleanly.
This commit is contained in:
parent
26b14b6ba8
commit
530009d830
9 changed files with 61 additions and 81 deletions
|
|
@ -115,7 +115,7 @@ local function setup_syntax(bufnr)
|
|||
vim.cmd([[
|
||||
syntax clear
|
||||
syntax match taskId /^\/\d\+\// conceal
|
||||
syntax match taskHeader /^## .*$/ contains=taskId
|
||||
syntax match taskHeader /^# .*$/ contains=taskId
|
||||
syntax match taskCheckbox /\[!\]/ contained containedin=taskLine
|
||||
syntax match taskLine /^\/\d\+\/- \[.\] .*$/ contains=taskId,taskCheckbox
|
||||
]])
|
||||
|
|
@ -205,9 +205,8 @@ local function apply_extmarks(bufnr, line_meta)
|
|||
else
|
||||
icon, icon_hl = icons.pending, 'Normal'
|
||||
end
|
||||
local icon_padded = icon .. ' '
|
||||
vim.api.nvim_buf_set_extmark(bufnr, task_ns, row, bracket_col, {
|
||||
virt_text = { { icon_padded, icon_hl } },
|
||||
virt_text = { { '[' .. icon .. ']', icon_hl } },
|
||||
virt_text_pos = 'overlay',
|
||||
priority = 100,
|
||||
})
|
||||
|
|
@ -218,7 +217,7 @@ local function apply_extmarks(bufnr, line_meta)
|
|||
hl_group = 'PendingHeader',
|
||||
})
|
||||
vim.api.nvim_buf_set_extmark(bufnr, task_ns, row, 0, {
|
||||
virt_text = { { icons.header .. ' ', 'PendingHeader' } },
|
||||
virt_text = { { icons.category .. ' ', 'PendingHeader' } },
|
||||
virt_text_pos = 'overlay',
|
||||
priority = 100,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue