aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-04-17 17:13:09 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-04-17 17:13:09 +0200
commitc2b9aff4a02950be993e5d3d6cee984ba0bd0745 (patch)
tree63af4cd10076147d48cb2a9a03f459289a7a0714
parent0e6c04945b6ce920bbd074e61949de62f1b41763 (diff)
downloadvis-spellcheck-c2b9aff4a02950be993e5d3d6cee984ba0bd0745.tar.gz
consider the environment variable VIS_SPELLLANG as default
If the variable VIS_SPELLLANG is not set the variable LANG is considered next. Passing the spellchecking language via the environment can be useful when starting vis from different contexts. My use case is different mail addresses in mutt. On one address I mostly communicate in English and on another I communicate in German. Passing the context specific language vis the environment safes setting the spellchecking language for each email I write.
-rw-r--r--spellcheck.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/spellcheck.lua b/spellcheck.lua
index 1d0d6c7..45d519a 100644
--- a/spellcheck.lua
+++ b/spellcheck.lua
@@ -1,7 +1,7 @@
-- Copyright (c) 2017-2019 Florian Fischer. All rights reserved.
-- Use of this source code is governed by a MIT license found in the LICENSE file.
local spellcheck = {}
-spellcheck.default_lang = (os.getenv('LANG') or ''):gsub('[.].*', '')
+spellcheck.default_lang = (os.getenv('VIS_SPELLLANG') or os.getenv('LANG') or ''):gsub('[.].*', '')
if not spellcheck.default_lang:match('^[a-z][a-z]_[A-Z][A-Z]$') then
spellcheck.default_lang = 'en_US'
end