neorg
neorg copied to clipboard
Add the option to disable spellcheck in code blocks
Issues
- [X] I have checked existing issues and there are no existing ones with the same request.
Feature description
Would it be possible to add an option to disable spellcheck for code blocks? Maybe in the code_block configuration of the concealer module? Which can then be used with vim.api.nvim_buf_set_extmark() when creating @neorg.tags.ranged_verbatim.code_block.
Here is how I currently disable it:
neorg.lua -> [core.concealer] configuration:
["core.concealer"] = {
config = {
icon_preset = "diamond",
icons = {
code_block = {
spell = false,
},
},
},
}, -- Adds pretty icons to your documents
concealer/module.lua -> render_code_block function:
- added the line 'spell = config.spell' to the opts of the function calls to vim.api.nvim_buf_set_extmark()
render_code_block = function(config, bufid, node)
[...]
for row_0b = row_start_0b, row_end_0bin do
local len = line_lengths[row_0b - row_start_0b + 1]
local mark_col_start_0b = math.max(0, col_start_0b - config.padding.left)
local mark_col_end_0bex = max_len + config.padding.right
if len >= mark_col_start_0b then
vim.api.nvim_buf_set_extmark(bufid, module.private.ns_icon, row_0b, mark_col_start_0b, {
end_row = row_0b + 1,
hl_eol = to_eol,
hl_group = config.highlight,
hl_mode = "blend",
virt_text = not to_eol and { { (" "):rep(mark_col_end_0bex - len), config.highlight } } or nil,
virt_text_pos = "overlay",
virt_text_win_col = len,
spell = config.spell,
})
else
vim.api.nvim_buf_set_extmark(bufid, module.private.ns_icon, row_0b, len, {
end_row = row_0b + 1,
hl_eol = to_eol,
hl_group = config.highlight,
hl_mode = "blend",
virt_text = {
{ (" "):rep(mark_col_start_0b - len) },
{ not to_eol and (" "):rep(mark_col_end_0bex - mark_col_start_0b) or "", config.highlight },
},
virt_text_pos = "overlay",
virt_text_win_col = len,
spell = config.spell,
})
end
end
end,
Help
Yes, but I don't know how to start. I would need guidance
Implementation help
I never did a pull request before
well you could just open a pr with the above change if that fixes it
Closing, as the feature was merged :)