diff options
| author | Nomarian <nomarian@outlook.com> | 2025-10-09 10:22:41 -0400 |
|---|---|---|
| committer | Nomarian <nomarian@outlook.com> | 2025-10-09 10:22:41 -0400 |
| commit | 97f9e91b137f7e652cf36cc9eec4783ae7acfbb3 (patch) | |
| tree | dc7fd5adaf0bdf29ef6e82ab964ee501e404090c | |
| parent | 79ed74eafe28bd22dab717d1504171d775888135 (diff) | |
| download | vis-spellcheck-97f9e91b137f7e652cf36cc9eec4783ae7acfbb3.tar.gz vis-spellcheck-97f9e91b137f7e652cf36cc9eec4783ae7acfbb3.zip | |
Set/find default_lang from a single string.match
| -rw-r--r-- | spellcheck.lua | 8 |
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 |
