aboutsummaryrefslogtreecommitdiffstats
path: root/spellcheck.lua
diff options
context:
space:
mode:
authorFlorian Fischer <muhq@muhq.space>2017-05-14 18:01:32 +0200
committerFlorian Fischer <muhq@muhq.space>2017-05-14 18:01:32 +0200
commit629088aeb9b38d6710995e8abd51df7d4706b025 (patch)
treeb6d9f8dacc775d1e2965355fc22b2142104e8b78 /spellcheck.lua
parent1d1dc0226e154110bec8d53d466de6e6b772708b (diff)
downloadvis-spellcheck-629088aeb9b38d6710995e8abd51df7d4706b025.tar.gz
add aspell and hunspell as default spellcheckers
Diffstat (limited to 'spellcheck.lua')
-rw-r--r--spellcheck.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/spellcheck.lua b/spellcheck.lua
index 4e0b13f..71023de 100644
--- a/spellcheck.lua
+++ b/spellcheck.lua
@@ -4,7 +4,15 @@
local module = {}
module.lang = os.getenv("LANG"):sub(0,5) or "en_US"
-- TODO use more spellcheckers (aspell/hunspell)
-module.cmd = "enchant -d %s -a"
+if os.execute("type enchant &>/dev/null") then
+ module.cmd = "enchant -d %s -a"
+elseif os.execute("type aspell &>/dev/null") then
+ module.cmd = "aspell -l %s -a"
+elseif os.execute("type hunspell &>/dev/null") then
+ module.cmd = "hunspell -d %s"
+else
+ return nil
+end
function spellcheck(file, range)
local cmd = module.cmd:format(module.lang)