feat(spell): also source spell/LANG.lua when setting spelllang (#22111)

Problem: only Vimscript files are sourced when setting spelling language
Solution: also source Lua files after sourcing Vimscript files

Closes #22110
This commit is contained in:
Christian Clason 2023-02-06 10:01:38 +01:00 committed by GitHub
parent 1675f0e270
commit e1f03c481a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -440,9 +440,9 @@ find these functions useful:
SETTING 'spellcapcheck' AUTOMATICALLY *set-spc-auto* SETTING 'spellcapcheck' AUTOMATICALLY *set-spc-auto*
After the 'spelllang' option has been set successfully, Vim will source the After the 'spelllang' option has been set successfully, Vim will source the
files "spell/LANG.vim" in 'runtimepath'. "LANG" is the value of 'spelllang' files "spell/LANG.vim" and "spell/LANG.lua" in 'runtimepath'. "LANG" is the
up to the first comma, dot or underscore. This can be used to set options value of 'spelllang' up to the first comma, dot or underscore. This can be
specifically for the language, especially 'spellcapcheck'. used to set options specifically for the language, especially 'spellcapcheck'.
The distribution includes a few of these files. Use this command to see what The distribution includes a few of these files. Use this command to see what
they do: > they do: >

View File

@ -1581,7 +1581,7 @@ static void do_spelllang_source(win_T *win)
q += 4; q += 4;
} }
// Source the spell/LANG.vim in 'runtimepath'. // Source the spell/LANG.{vim,lua} in 'runtimepath'.
// They could set 'spellcapcheck' depending on the language. // They could set 'spellcapcheck' depending on the language.
// Use the first name in 'spelllang' up to '_region' or // Use the first name in 'spelllang' up to '_region' or
// '.encoding'. // '.encoding'.
@ -1592,7 +1592,7 @@ static void do_spelllang_source(win_T *win)
} }
} }
if (p > q) { if (p > q) {
vim_snprintf(fname, sizeof(fname), "spell/%.*s.vim", (int)(p - q), q); vim_snprintf(fname, sizeof(fname), "spell/%.*s.\\(vim\\|lua\\)", (int)(p - q), q);
source_runtime(fname, DIP_ALL); source_runtime(fname, DIP_ALL);
} }
} }