commit bff7d3fd9f20fe8f8373844454181550dc6ba05d
parent f1f106be3d243ad0561cda4a35b0b7911e02d03e
Author: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
Date: Sat, 28 Jun 2025 23:40:24 +0700
fix(tutor): cannot find tutors in pack/*/start/* #34689
Problems:
- Unlike in Vim, Neovim does not report pack/*/start/* in the resolved value of 'rtp' (see `:help packages-runtimepath`)
- This means that the tutor plugin cannot find the tutors in pack/*/start/*
Solution:
- Use nvim_list_runtime_paths() instead of &rtp
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim
@@ -170,14 +170,18 @@ endfunction
" returns a list of all tutor files matching the given name
function! tutor#GlobTutorials(name, locale)
let locale = a:locale
+ " pack/*/start/* are not reported in &rtp
+ let rtp = nvim_list_runtime_paths()
+ \ ->map({_, v -> escape(v:lua.vim.fs.normalize(v), ',')})
+ \ ->join(',')
" search for tutorials:
" 1. non-localized
- let l:tutors = s:GlobPath(&rtp, 'tutor/'.a:name.'.tutor')
+ let l:tutors = s:GlobPath(rtp, 'tutor/'.a:name.'.tutor')
" 2. localized for current locale
- let l:locale_tutors = s:GlobPath(&rtp, 'tutor/'.locale.'/'.a:name.'.tutor')
+ let l:locale_tutors = s:GlobPath(rtp, 'tutor/'.locale.'/'.a:name.'.tutor')
" 3. fallback to 'en'
if len(l:locale_tutors) == 0
- let l:locale_tutors = s:GlobPath(&rtp, 'tutor/en/'.a:name.'.tutor')
+ let l:locale_tutors = s:GlobPath(rtp, 'tutor/en/'.a:name.'.tutor')
endif
call extend(l:tutors, l:locale_tutors)
return uniq(sort(l:tutors, 's:Sort'), 's:Sort')