1:: Start Vim on a copy of the tutor file. 2@echo off 3 4:: Usage: vimtutor [-console] [xx] 5:: 6:: -console means gvim will not be used 7:: xx is a language code like "es" or "nl". 8:: When an xx argument is given, it tries loading that tutor. 9:: When this fails or no xx argument was given, it tries using 'v:lang' 10:: When that also fails, it uses the English version. 11 12:: Use Vim to copy the tutor, it knows the value of $VIMRUNTIME 13FOR %%d in (. %TMP% %TEMP%) DO IF EXIST %%d\nul SET TUTORCOPY=%%d\$tutor$ 14 15SET xx=%1 16 17IF NOT .%1==.-console GOTO use_gui 18SHIFT 19SET xx=%1 20GOTO use_vim 21:use_gui 22 23:: Try making a copy of tutor with gvim. If gvim cannot be found, try using 24:: vim instead. If vim cannot be found, alert user to check environment and 25:: installation. 26 27:: The script tutor.vim tells Vim which file to copy. 28:: For Windows NT "start" works a bit differently. 29IF .%OS%==.Windows_NT GOTO ntaction 30 31start /w gvim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" 32IF ERRORLEVEL 1 GOTO use_vim 33 34:: Start gvim without any .vimrc, set 'nocompatible' 35start /w gvim -u NONE -c "set nocp" %TUTORCOPY% 36 37GOTO end 38 39:ntaction 40start "dummy" /b /w gvim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" 41IF ERRORLEVEL 1 GOTO use_vim 42 43:: Start gvim without any .vimrc, set 'nocompatible' 44start "dummy" /b /w gvim -u NONE -c "set nocp" %TUTORCOPY% 45 46GOTO end 47 48:use_vim 49:: The script tutor.vim tells Vim which file to copy 50vim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" 51IF ERRORLEVEL 1 GOTO no_executable 52 53:: Start vim without any .vimrc, set 'nocompatible' 54vim -u NONE -c "set nocp" %TUTORCOPY% 55 56GOTO end 57 58:no_executable 59ECHO. 60ECHO. 61ECHO No vim or gvim found in current directory or PATH. 62ECHO Check your installation or re-run install.exe 63 64:end 65:: remove the copy of the tutor 66IF EXIST %TUTORCOPY% DEL %TUTORCOPY% 67SET xx= 68