dpelle / vim-Grammalecte

A vim plugin for the Grammalecte French grammar checker
83 stars 11 forks source link

Use `@Spell` and `@NoSpell` clusters #3

Open Karmaki opened 7 years ago

Karmaki commented 7 years ago

This tool is really great, but it could even be better if it could use the @Spell and @NoSpell clusters defined in some syntax files (same thing for vim-LanguageTool that is great too, but has the same default).

dpelle commented 7 years ago

I'm not sure where and why you would want to use @Spell and @NoSpell. The vim-Grammalecte plugin does not use vim spelling checker. All highlighting (grammar errors and spelling errors) come from Grammalecte (or from LanguageTool for vim-LanguageTool plugin). Please elaborate if I missed a valid use of @Spell and @NoSpell.

For French, using the spelling checker of Grammalecte of LanguageTool is an improvement over the spelling checker of Vim, as French vim spelling checker is stuck with a very old version, based on aspell. Vim French spelling checker cannot be easily upgraded to a more recent French dictionary because Vim does not understand latest Hunspell features used by the http://dicollecte.org French dictionary. Spell checking with the plugins vim-Grammalecte (or vim-LanguageTool) does not have this problem.

Karmaki commented 7 years ago

First, thanks for your very quick answer.

I would be interested by this feature because I write a lot of markdown with blocks of code inside. The spell checker is able to skip the code (@NoSpell cluster), but I am getting a lot of errors about the punctuation in the code parts with the grammar checkers.

At the moment, I don't code a lot, but the contrary would occur on source files where the spell checker only works on the comments (@Spell cluster), but not on the code itself.

But I understand that I might be difficult to do...

dpelle commented 7 years ago

I write a lot of markdown with blocks of code inside.

Oh I now see. Yes, checking only text with @Spell would be very useful. Well, @Spell may not be enough. Consider this:

  /*
   * A comment with
   * with an error on multiple lines (repeated word "with").
   */

The problem is that even if we feed the grammar checker with comments only (which have @Spell), it will see a string with a star in the middle and that will prevent the grammar checker from analyzing properly i.e. it will not find the duplicated word in "with * with".

Despite this limitation, checking text with @Spell (as an option), would be better than nothing. I'll see how it can be done.

Karmaki commented 7 years ago

At the moment, ignoring the text with @NoSpell would be even more useful for me, and maybe easier to do...

mokas01 commented 6 years ago

Quick (although late) follow-up question : i use your plugin to check a 300 pages document in latex… all tex code (generally in the form \command[argument]{argument}) is in English and considered as incorrect. i have hundreds of false positives, which could be removed if i could have a nospell or any other way to exclude them

Thanks for the help