From bff7d3fd9f20fe8f8373844454181550dc6ba05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20B=C3=ACnh=20An?= <111893501+brianhuster@users.noreply.github.com> Date: Sat, 28 Jun 2025 23:40:24 +0700 Subject: [PATCH] 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 --- runtime/autoload/tutor.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim index 578e5e7e8f..d8f0f65139 100644 --- 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')