Skip to content

Commit d383f5c

Browse files
Übertreiberbroken-pen
andauthored
Force-disable spellcheck in certain markup groups. (#547)
Co-authored-by: Nico Madysa <[email protected]>
1 parent 60e8700 commit d383f5c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lua/orgmode/colors/markup_highlighter.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,21 @@ local markers = {
3636
hl_name = 'org_code',
3737
hl_cmd = 'hi def link org_code String',
3838
nestable = false,
39+
spell = false,
3940
type = 'text',
4041
},
4142
['='] = {
4243
hl_name = 'org_verbatim',
4344
hl_cmd = 'hi def link org_verbatim String',
4445
nestable = false,
46+
spell = false,
4547
type = 'text',
4648
},
4749
['\\('] = {
4850
hl_name = 'org_latex',
4951
hl_cmd = 'hi def link org_latex OrgTSLatex',
5052
nestable = false,
53+
spell = false,
5154
type = 'latex',
5255
},
5356
['\\{'] = {
@@ -381,6 +384,7 @@ local function apply(namespace, bufnr, line_index)
381384
ephemeral = true,
382385
end_col = range.to['end'].character,
383386
hl_group = markers[range.type].hl_name,
387+
spell = markers[range.type].spell,
384388
priority = 110 + range.from.start.character,
385389
})
386390

@@ -402,6 +406,7 @@ local function apply(namespace, bufnr, line_index)
402406
local line = vim.api.nvim_buf_get_lines(bufnr, link_range.from.start.line, link_range.from.start.line + 1, false)[1]
403407
local link = line:sub(link_range.from.start.character + 1, link_range.to['end'].character)
404408
local alias = link:find('%]%[') or 1
409+
local link_end = link:find('%]%[') or (link:len() - 1)
405410

406411
vim.api.nvim_buf_set_extmark(bufnr, namespace, link_range.from.start.line, link_range.from.start.character, {
407412
ephemeral = true,
@@ -416,6 +421,12 @@ local function apply(namespace, bufnr, line_index)
416421
conceal = '',
417422
})
418423

424+
vim.api.nvim_buf_set_extmark(bufnr, namespace, link_range.from.start.line, link_range.from.start.character + 2, {
425+
ephemeral = true,
426+
end_col = link_range.from.start.character - 1 + link_end,
427+
spell = false,
428+
})
429+
419430
vim.api.nvim_buf_set_extmark(bufnr, namespace, link_range.from.start.line, link_range.to['end'].character - 2, {
420431
ephemeral = true,
421432
end_col = link_range.to['end'].character,
@@ -428,6 +439,7 @@ local function apply(namespace, bufnr, line_index)
428439
ephemeral = true,
429440
end_col = latex_range.to['end'].character,
430441
hl_group = markers[latex_range.type].hl_name,
442+
spell = markers[latex_range.type].spell,
431443
priority = 110 + latex_range.from.start.character,
432444
})
433445
end

0 commit comments

Comments
 (0)