From ebdd1360935b8c27eae6929042b0386af3e2e43b Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 26 Aug 2020 19:11:14 +0200 Subject: add the option 'disable_syntax_awareness' to always check the full viewport --- Readme.md | 2 ++ spellcheck.lua | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 2f41b91..dd18c64 100644 --- a/Readme.md +++ b/Readme.md @@ -29,6 +29,8 @@ The module table returned from `require(...)` has some configuration options: * default: `fore:red` * `check_tokens`: A table mapping all token names we consider for spellchecking to true * default: `{[vis.lexers.STRING]=true, [vis.lexers.COMMENT]=true}` +* `disable_syntax_awareness`: Disable the syntax aware spellchecking and use always _full viewport_ + * default: `false` A possible configuration could look like this: diff --git a/spellcheck.lua b/spellcheck.lua index aacdd94..782fe8f 100644 --- a/spellcheck.lua +++ b/spellcheck.lua @@ -24,6 +24,7 @@ end spellcheck.typo_style = "fore:red" spellcheck.check_full_viewport = {} +spellcheck.disable_syntax_awareness = false spellcheck.check_tokens = { [vis.lexers.STRING] = true, @@ -203,7 +204,7 @@ local enable_spellcheck = function() return end - if vis.win.syntax and vis.lexers.load then + if not spellcheck.disable_syntax_awareness and vis.win.syntax and vis.lexers.load then local lexer = vis.lexers.load(vis.win.syntax, nil, true) if lexer and lexer.lex then local old_lex_func = lexer.lex -- cgit v1.2.3