From c2b9aff4a02950be993e5d3d6cee984ba0bd0745 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 17 Apr 2023 17:13:09 +0200 Subject: 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. --- spellcheck.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3