Try
syntax match MyPages /\<p\d\+\%(-\d\+\)\=\>/ contains=@NoSpell
This would work for an existing buffer, to (auto)apply it, let's assume you're in filetype=text
augroup NoSpellPages
au!
au Filetype text syntax match MyPages /\<p\d\+\%(-\d\+\)\=\>/ contains=@NoSpell
augroup END
au!
au Filetype text syntax match MyPages /\<p\d\+\%(-\d\+\)\=\>/ contains=@NoSpell
augroup END
On Thursday, August 28, 2025 at 11:29:47 AM UTC+10 Tim Chase wrote:
Taking some notes, I have a lot of page-references of the form "p12",
"p35-36", etc. With 'spell' set, it highlights them as misspelled
words. However, I can formulate a regex that would identify these:
/\<p\d\+\%(-\d\+\)\=\>/
Is there a way to convey this information to vim so that they get
ignored for spellcheck purposes?
I know there's some highlight-group aspect that might be usable,
contains=@NoSpell
as detailed at `:help spell-syntax`, so I think I have the relevant
pieces, but am just failing to put them together in the right way
(writing syntax files is not my forte)
What do I need to do to assemble these so spell-checking ignores my
page-number ranges?
Thanks,
-tim
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/9c827a6a-778d-4c86-856f-d115aba83bddn%40googlegroups.com.
No comments:
Post a Comment