aboutsummaryrefslogtreecommitdiff
path: root/spellcheck.lua
diff options
context:
space:
mode:
authorNomarian <nomarian@outlook.com>2025-10-09 10:22:41 -0400
committerNomarian <nomarian@outlook.com>2025-10-09 10:22:41 -0400
commit97f9e91b137f7e652cf36cc9eec4783ae7acfbb3 (patch)
treedc7fd5adaf0bdf29ef6e82ab964ee501e404090c /spellcheck.lua
parent79ed74eafe28bd22dab717d1504171d775888135 (diff)
downloadvis-spellcheck-97f9e91b137f7e652cf36cc9eec4783ae7acfbb3.tar.gz
vis-spellcheck-97f9e91b137f7e652cf36cc9eec4783ae7acfbb3.zip
Set/find default_lang from a single string.match
Diffstat (limited to 'spellcheck.lua')
-rw-r--r--spellcheck.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/spellcheck.lua b/spellcheck.lua
index b5d99fb..4e1239e 100644
--- a/spellcheck.lua
+++ b/spellcheck.lua
@@ -3,10 +3,10 @@
local vis = _G.vis
local spellcheck = {}
-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
+spellcheck.default_lang = string.match(
+ os.getenv('VIS_SPELLLANG') or os.getenv('LANG') or ''
+ , "^%l%l_%u%u"
+) or 'en_US'
spellcheck.spelling_autoenable = false