aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorLeonardo Mello <lsvmello@gmail.com>2023-09-26 10:31:35 -0300
committerGitHub <noreply@github.com>2023-09-26 06:31:35 -0700
commitbc6fc0123d2f02b1f209cbec740665033fbb5892 (patch)
tree627eed3e40b44856b6de0cb2fc620882b58c182f /runtime/autoload
parentfe95037cdb9b0294ca24dbd0ff82c8462d051307 (diff)
downloadrneovim-bc6fc0123d2f02b1f209cbec740665033fbb5892.tar.gz
rneovim-bc6fc0123d2f02b1f209cbec740665033fbb5892.tar.bz2
rneovim-bc6fc0123d2f02b1f209cbec740665033fbb5892.zip
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
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/tutor.vim10
1 files changed, 10 insertions, 0 deletions
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