2

I'm trying to create a list of 'rare' words as a supplementary spellfile so

  • I have created list.utf-8.add and used mkspell! to create list.utf-8.add.spl

  • I included list.utf-8.add in my spellfile setting

If I append /! to every word to mark it as 'bad', the highlighting works as expected (every word is highlighted per SpellBad.)

However, if I append /? instead to every word to mark it as 'rare', the words are not highlighted at all. I verified that SpellRare is correctly configured.

What am I missing?

===

Adding more information:

What I am trying to do is use my tags file to create a spellfile that will highlight identifiers and such in comments as 'rare' words. Since these are identifiers and not natural language words, they have 'unusual' characteristics, such as embedded underscores.

After further experimentation, I have found that a few identifiers from the list do get highlighted with SpellRare, but most don't get highlighted at all and others have parts highlighted as SpellBad.

In detail:

  • If the words in the list are marked as 'valid' (i.e., no flags), then the spell check considers them valid and they are not highlighted
  • If the words in the list are marked as 'bad' (i.e., /! flag), then the spell check considers them bad and they are highlighted with SpellBad
  • If the words in the list are marked as 'rare' (i.e, /? flag), then "it depends"
    • If the first part of the word up to a '_' is not a valid natural language word then the whole word is marked as 'rare' and highlighted with SpellRare
    • Otherwise, each part of the word (delimited by '_') is considered valid or not on its own depending on whether it is a valid natural language word or not, and highlighted accordingly
2
  • I observed something very similar. In my case I can flag the strings par ex. and p.ex. as good words, or as bad words, but flagging them as rare words would not work. With what you wrote, I suspect this is due to the presence of a non-word character in the middle of them. Looks like a Vim bug to me, did you consider reporting it?
    – Maëlan
    Jun 9, 2022 at 6:12
  • More tests: if I flag xxx.yyy as bad, then it is always shown as bad as a whole (i.e. the dot is highlighted too), which is the expected outcome, If I rather flag it as good/rare, then it is generally shown as good/rare but if the word gets highlighted for another reason (missing capital), then only the first part gets the special highlighting (the capitalization warning) while the 2nd part is shown as wrong. Weirder: in that situation, if I let the cursor run over the word, then highlighting switches to the correct outcome! And conversely if I go back! Definitely a bug I’d say.
    – Maëlan
    Jun 9, 2022 at 6:19

1 Answer 1

1

Coming back to this problem after a long hiatus.

The solution is to switch from "word list" format to Myspell format, and define '_' as a mid-word character by putting the line

MIDWORD _

in the .aff file, along with

RARE ?

to specify that (for example) '?' will be used to flag "rare" words in the .dic file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.