aboutsummaryrefslogtreecommitdiff
path: root/spellcheck.lua
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-11-06 12:38:58 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-11-06 12:38:58 +0100
commitb90a49c42dbe49121acfdff58d754073a1a9f75f (patch)
tree17bf945a8525baa84d9b2cf2224ad056e5903726 /spellcheck.lua
parent1727981f75051b659a50f29f7ad3a9ab97e6bc87 (diff)
downloadvis-spellcheck-b90a49c42dbe49121acfdff58d754073a1a9f75f.tar.gz
vis-spellcheck-b90a49c42dbe49121acfdff58d754073a1a9f75f.zip
make selection of spellchecker more usable with different shells
Diffstat (limited to 'spellcheck.lua')
-rw-r--r--spellcheck.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/spellcheck.lua b/spellcheck.lua
index b7a9c19..6c16afc 100644
--- a/spellcheck.lua
+++ b/spellcheck.lua
@@ -3,16 +3,17 @@
local spellcheck = {}
spellcheck.lang = os.getenv("LANG"):sub(0,5) or "en_US"
-if os.execute("type enchant &>/dev/null") then
+local supress_output = ">/dev/null 2>/dev/null"
+if os.execute("type enchant "..supress_output) then
spellcheck.cmd = "enchant -d %s -a"
spellcheck.list_cmd = "enchant -l -d %s -a"
-elseif os.execute("type enchant-2 &>/dev/null") then
+elseif os.execute("type enchant-2 "..supress_output) then
spellcheck.cmd = "enchant-2 -d %s -a"
spellcheck.list_cmd = "enchant-2 -l -d %s -a"
-elseif os.execute("type aspell &>/dev/null") then
+elseif os.execute("type aspell "..supress_output) then
spellcheck.cmd = "aspell -l %s -a"
spellcheck.list_cmd = "aspell list -l %s -a"
-elseif os.execute("type hunspell &>/dev/null") then
+elseif os.execute("type hunspell "..supress_output) then
spellcheck.cmd = "hunspell -d %s"
spellcheck.list_cmd = "hunspell -l -d %s"
else