aboutsummaryrefslogtreecommitdiff
path: root/plugins/spellcheck.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-03-11 07:14:43 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-22 13:16:10 -0400
commitfb40e73fcd01e044ac6c8b9d9fee1230d7a98c93 (patch)
tree8fb32486155bde3eb33625d4a14941f315b5673a /plugins/spellcheck.lua
parent6c7cb500350377e89a930228747c4aa5f13e8716 (diff)
downloadlite-xl-plugins-fb40e73fcd01e044ac6c8b9d9fee1230d7a98c93.tar.gz
lite-xl-plugins-fb40e73fcd01e044ac6c8b9d9fee1230d7a98c93.zip
spellcheck: added toggle command
Diffstat (limited to 'plugins/spellcheck.lua')
-rw-r--r--plugins/spellcheck.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/spellcheck.lua b/plugins/spellcheck.lua
index 30e16c9..566bd3e 100644
--- a/plugins/spellcheck.lua
+++ b/plugins/spellcheck.lua
@@ -8,6 +8,7 @@ local DocView = require "core.docview"
local Doc = require "core.doc"
config.plugins.spellcheck = common.merge({
+ enable = true,
files = { "%.txt$", "%.md$", "%.markdown$" },
dictionary_file = PLATFORM == "Windows"
and EXEDIR .. "/words.txt"
@@ -66,6 +67,8 @@ function DocView:draw_line_text(idx, x, y)
draw_line_text(self, idx, x, y)
if
+ not config.plugins.spellcheck.enable
+ or
not words
or
not matches_any(self.doc.filename or "", config.plugins.spellcheck.files)
@@ -118,6 +121,10 @@ end
command.add("core.docview", {
+ ["spell-check:toggle"] = function()
+ config.plugins.spellcheck.enable = not config.plugins.spellcheck.enable
+ end,
+
["spell-check:add-to-dictionary"] = function()
local word = get_word_at_caret()
if words[word] then