Merge pull request #34137 from brianhuster/vim-2323f22

vim-patch: add chapter 2 of beginner tutor
This commit is contained in:
zeertzjq
2025-05-24 06:48:34 +08:00
committed by GitHub
7 changed files with 273 additions and 44 deletions

View File

@@ -93,14 +93,14 @@ describe(':Tutor', function()
{0: } |
]]
feed(':700<CR>zt')
feed(':702<CR>zt')
screen:expect(expected)
end)
it('applies hyperlink highlighting', function()
local expected = [[
{0: }^ |
{0: }{3:#}{5: CONCLUSION} |
{0: }^This concludes Chapter 1 of the Vim Tutor. Consider continuing with |
{0: }{2:Chapter 2}. |
{0: } |
{0: }This was intended to give a brief overview of the Neovim editor, just enough to|
{0: }allow you to use it fairly easily. It is far from complete as Neovim has |
@@ -131,7 +131,7 @@ describe(':Tutor', function()
{0: }University. E-mail: {2:bware@mines.colorado.edu}. |
]]
feed(':978<CR>zt')
feed(':983<CR>zt')
screen:expect(expected)
end)
end)

View File

@@ -14,3 +14,21 @@ func Test_auto_enable_interactive()
call assert_true(empty(&buftype))
call assert_match('tutor#EnableInteractive', b:undo_ftplugin)
endfunc
func Test_tutor_link()
let tutor_files = globpath($VIMRUNTIME, 'tutor/**/*.tutor', 0, 1)
let pattern = '\[.\{-}@tutor:\zs[^)\]]*\ze[)\]]'
for tutor_file in tutor_files
let lang = fnamemodify(tutor_file, ':h:t')
if lang == 'tutor'
let lang = 'en'
endif
let text = readfile(tutor_file)
let links = matchstrlist(text, pattern)->map({_, v -> v.text})
for link in links
call assert_true(tutor#GlobTutorials(link, lang)->len() > 0)
endfor
endfor
endfunc