-
-
Notifications
You must be signed in to change notification settings - Fork 168
Force-disable spellcheck in certain markup groups. #547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force-disable spellcheck in certain markup groups. #547
Conversation
Hmm, something is still strange about this. The change in this PR does indeed remove highlighting for bad words, but the keymaps |
85da2b3
to
338c04c
Compare
hl_name = 'org_underline', | ||
hl_cmd = 'hi def org_underline term=underline cterm=underline gui=underline', | ||
nestable = true, | ||
spell = nil, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe all spell = nil
can be removed, since it will default to nil
when it tries to find something on table that does not exist.
I can confirm that this works, but has that issue you mentioned that it jumps to the works that should not have spell checking. Do you maybe have any news on that? |
338c04c
to
0664942
Compare
Sorry, this week has been pretty busy. I only found time to sit down and look into it tonight. As far as I can tell, this buggy behavior is universal for neovim extmarks. I've opened an issue about this with them (see the mention above), let's see what comes out of that. Regarding a workaround on the orgmode side, I'm not quite sure how to do that. Using captures sounds promising, but my (extremely limited) understanding is that the TS grammar doesn't currently track inline markup. See this screenshot of the Naively, I would've expected a TS nodes like "code" , but instead everything is just "expr" and the actual highlighting is done with extmarks. With this set up, I don't know if it's possible to define specific captures for spell checking. |
Don't worry, this is open source, no one expects you to be around on demand :) It seems there is a draft PR that fixes the issue so I hope it will cover this. I'll double check this PR and merge it if it's ok. Thanks! I think you misunderstood what I meant. I meant to remove the old vim syntax spell checking and introduce it on the treesitter level in the queries, something like this https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/ecma/highlights.scm#L179. This can be done separately, so don't worry about it. |
This passes the `spell` option to `nvim_buf_set_extmark()` for all markup groups. In most cases, the passed value is simply `nil`, i.e. the same as if it were not passed at all. In the following cases, however, we pass `spell=false`, i.e. forcefully disable spell-checking: - the URL part of `[[URL][hyperlinks]]`; - the inside of `[[hyperlinks]]` without description; - `~code~` and `=verbatim=` spans; - in-line LaTeX markup using `\(parentheses\)`. The reason in all cases is that these spans are extremely likely to contain purposefully non-orthographic spelling, in particular hyperlinks.
0664942
to
ae9195d
Compare
I had to dig a little, but I think In any case, I've removed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Just a note that I added support for tree-sitter level spell checking here 4647d20, so spell checking should generally be better than before. |
Very cool! I'll give it a try and report bugs if I find any 👍 |
Co-authored-by: Nico Madysa <[email protected]>
This passes the
spell
option tonvim_buf_set_extmark()
for all markup groups. In most cases, the passed value is simplynil
, i.e. the same as if it were not passed at all.In the following cases, however, we pass
spell=false
, i.e. forcefully disable spell-checking:[[URL][hyperlinks]]
;[[hyperlinks]]
without description;~code~
and=verbatim=
spans;\(parentheses\)
.The reason in all cases is that these spans are extremely likely to contain purposefully non-orthographic spelling, in particular hyperlinks.