Skip to content

Commit 92cb84e

Browse files
Use tree-sitter highlights for block begin/end
1 parent 158c350 commit 92cb84e

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

lua/orgmode/colors/highlights.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function M.link_ts_highlights()
2929
OrgTSPlan = 'Constant',
3030
OrgTSComment = 'Comment',
3131
OrgTSDirective = 'Comment',
32+
OrgTSBlock = 'Comment',
3233
}
3334

3435
for src, def in pairs(links) do
@@ -105,7 +106,7 @@ function M.define_org_headline_colors(faces)
105106
if not ts_highlights_enabled then
106107
vim.cmd([[syn match OrgHideLeadingStars /^\*\{2,\}/me=e-1 contained]])
107108
end
108-
vim.cmd([[hi def link OrgHideLeadingStars org_hide_leading_stars]])
109+
vim.cmd([[hi default OrgHideLeadingStars ctermfg=0 guifg=bg]])
109110
table.insert(contains, 'OrgHideLeadingStars')
110111
end
111112
contains = table.concat(contains, ',')

queries/org/highlights.scm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
(listitem . (bullet) . (paragraph . (expr "[" "str" @OrgCheckDone "]") @OrgTSCheckboxChecked (#match? @OrgTSCheckboxChecked "\[[xX]\]")))
1313
(listitem . (bullet) . (paragraph . (expr "[" "-" @OrgCheckInProgress "]") @OrgTSCheckboxHalfChecked (#eq? @OrgTSCheckboxHalfChecked "[-]")))
1414
(listitem . (bullet) . (paragraph . ((expr "[") @OrgTSCheckbox.left (#eq? @OrgTSCheckbox.left "[") . (expr "]") @OrgTSCheckbox.right (#eq? @OrgTSCheckbox.right "]"))))
15+
(block "#+begin_" @OrgTSBlock "#+end_" @OrgTSBlock "str" @OrgTSBlock)
16+
(block name: (expr) @OrgTSBlock)
17+
(block parameter: (expr) @OrgTSBlock)
1518
(property_drawer) @OrgTSPropertyDrawer
1619
(drawer) @OrgTSDrawer
1720
(tag) @OrgTSTag

syntax/org.vim

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,8 @@ lua require('orgmode.org.syntax').add_todo_keywords_to_spellgood()
99
let s:ts_highlight = luaeval('require("orgmode.config"):ts_highlights_enabled()')
1010
if !s:ts_highlight
1111
runtime syntax/org_legacy.vim
12-
else
13-
syntax match org_block_delimiter /^\s*#+\(BEGIN_\|begin_\).*/
14-
syntax match org_block_delimiter /^\s*#+\(END_\|end_\).*/
15-
hi default link org_block_delimiter Comment
1612
endif
1713

18-
hi org_hide_leading_stars ctermfg=0 guifg=bg
19-
20-
" Tables
21-
syntax match org_table_hrule /^\s*|[-+]*|\s*$/
22-
hi org_table_hrule gui=NONE cterm=NONE
23-
2414
syntax spell toplevel
2515

2616
lua require("orgmode.org.syntax").load_code_blocks()

0 commit comments

Comments
 (0)