From 0c2bf55e909cfdb957be18352c807887ad53128e Mon Sep 17 00:00:00 2001 From: brianhuster Date: Tue, 13 May 2025 06:54:48 +0700 Subject: [PATCH] fix(tutor): l:lang is undefined Problem: The scope `elseif $LC_MESSAGES =~ '\a\a' || $LC_MESSAGES ==# "C"` in function `s:Locale` in file `runtime/autoload/tutor.vim` leaves a case when l:lang is not defined. Solution: Define `l:lang` at function scope instead of `if` scope (cherry picked from commit e5665754d1b20a531d6168ad0efece486fb86a17) --- runtime/autoload/tutor.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim index 8e3e524649..26440e9af3 100644 --- a/runtime/autoload/tutor.vim +++ b/runtime/autoload/tutor.vim @@ -120,6 +120,8 @@ endfunction " Tutor Cmd: {{{1 function! s:Locale() + " Make sure l:lang exists before returning. + let l:lang = 'en_US' if exists('v:lang') && v:lang =~ '\a\a' let l:lang = v:lang elseif $LC_ALL =~ '\a\a' @@ -132,8 +134,6 @@ function! s:Locale() endif elseif $LANG =~ '\a\a' let l:lang = $LANG - else - let l:lang = 'en_US' endif return split(l:lang, '_') endfunction