From bc6fc0123d2f02b1f209cbec740665033fbb5892 Mon Sep 17 00:00:00 2001 From: Leonardo Mello Date: Tue, 26 Sep 2023 10:31:35 -0300 Subject: fix(tutor): Tutor steps don't work on Windows #25251 Problem: Some steps in :Tutor don't work on Windows. Solution: Add support for `{unix:...,win:...}` format and transform the Tutor contents depending on the platform. Fix https://github.com/neovim/neovim/issues/24166 --- runtime/autoload/tutor.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'runtime/autoload') diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim index 80c09488d5..701be28ccc 100644 --- a/runtime/autoload/tutor.vim +++ b/runtime/autoload/tutor.vim @@ -220,6 +220,7 @@ function! tutor#TutorCmd(tutor_name) call tutor#SetupVim() exe "edit ".l:to_open + call tutor#ApplyTransform() endfunction function! tutor#TutorCmdComplete(lead,line,pos) @@ -227,3 +228,12 @@ function! tutor#TutorCmdComplete(lead,line,pos) let l:names = uniq(sort(map(l:tutors, 'fnamemodify(v:val, ":t:r")'), 's:Sort')) return join(l:names, "\n") endfunction + +function! tutor#ApplyTransform() + if has('win32') + sil! %s/{unix:(\(.\{-}\)),win:(\(.\{-}\))}/\2/g + else + sil! %s/{unix:(\(.\{-}\)),win:(\(.\{-}\))}/\1/g + endif + normal! gg0 +endfunction -- cgit