dpelle / vim-LanguageTool

A vim plugin for the LanguageTool grammar checker
281 stars 28 forks source link

How to enable/disable rules/categories #17

Open abers opened 5 years ago

abers commented 5 years ago

I can't figure out from the README how to enable/disable rules/categories. I've tried various settings in my vimrc but none seem to have any influence of what are used during checks. For example, the STYLE category is supposed to include passive voice. However - let g:languagetool_enable_categories = 'STYLE' Does not enable the passive voice rule. And - let g:languagetool_enable_categories = 'STYLE' gives an invalid expression error. Additionally, is there a list of all the available categories that can be enabled?

abers commented 5 years ago
"Enable all categories
let g:languagetool_enable_categories = 'PUNCTUATION,TYPOGRAPHY,CASING,COLLOCATIONS,CONFUSED_WORDS,CREATIVE_WRITING,GRAMMAR,MISC,MISUSED_TERMS_EU_PUBLICATIONS,NONSTANDARD_PHRASES,PLAIN_ENGLISH,TYPOS,REDUNDANCY,SEMANTICS,TEXT_ANALYSIS,STYLE,GENDER_NEUTRALITY'

"Enable all special rules that cannot be enabled via category
let g:languagetool_enable_rules = 'AND_ALSO,ARE_ABLE_TO,ARTICLE_MISSING,AS_FAR_AS_X_IS_CONCERNED,BEST_EVER,BLEND_TOGETHER,BRIEF_MOMENT,CAN_NOT,CANT_HELP_BUT,COMMA_WHICH,EG_NO_COMMA,ELLIPSIS,EXACT_SAME,HONEST_TRUTH,HOPEFULLY,IE_NO_COMMA,IN_ORDER_TO,I_VE_A,NEGATE_MEANING,PASSIVE_VOICE,PLAN_ENGLISH,REASON_WHY,SENT_START_NUM,SERIAL_COMMA_OFF,SERIAL_COMMA_ON,SMARTPHONE,THREE_NN,TIRED_INTENSIFIERS,ULESLESS_THAT,WIKIPEDIA,WORLD_AROUND_IT'

Turns out that PASSIVE_VOICE, and other rules, are special in that they cannot be enabled via category and need to specifically called. The above enables all rules and categories I could find.

Konfekt commented 5 years ago

To add a category, you append it to the comma separated list g:languagetool_enable_categories.

if !empty(g:languagetool_enable_categories)
 let g:languagetool_enable_categories .= ',STYLE'
else
  let g:languagetool_enable_categories = 'STYLE'
endif

Turns out that PASSIVE_VOICE, and other rules, are special in that they cannot be enabled via category and need to specifically called.

Thus there is seemingly no issue with this plug-in, but with languagetool that does not allow for enabling a rule such as passive_voice by enabling the category that it is contained in. You should open the issue at https://github.com/languagetool-org/languagetool/issues/new

abers commented 5 years ago

Aye, was posting an update as I had found a solution to the problem. It might be worth adding to the help file for vim-languagetool, however, examples for languagetool_enable_categories and languagetool_enable_rules. Also be worth adding a note that certain rules have to be explicitly enabled and cannot be enabled by category.

Konfekt commented 5 years ago

Have also a look at my simple Vim LanguageTool plug-in https://github.com/Konfekt/vim-langtool