Windows vimtutor problems

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Windows vimtutor problems

Yongwei Wu
This is a copy of my issue submitted on GitHub. Maybe the mailing list is still the preferred place for discussions?

The current vimtutor.bat has several problems. It basically does not work on modern Windows with the default installation path.

When launching the vim tutor from the start menu, one can see that the tutor appears. The problem is that it is not the copy as intended, but just the tutor file under "C:\Program Files (x86)\Vim\vim82\tutor". After digging around a bit, I have found:

Problem 1: vimtutor.bat cannot really determine whether a directory is writable or not.

FOR %%d in (. "%TMP%" "%TEMP%") DO IF EXIST %%d\nul SET TUTORCOPY=%%d\$tutor$

This line does not work. I am not sure whether it used to work or not, but it does not now. "C:\Program Files (x86)\Vim\vim82" is not writable in modern Windows, but the script cannot detect the case.

After struggling with the batch file for a while (oh, bash looks such a beauty, when compared with the quirkiness of Windows batch), I changed that line to the following:

FOR %%d in (. %TMP% %TEMP%) DO (
call :test_dir %0 %%d

echo No working directory is found
GOTO end

SET TUTORCOPY=%2\$tutor$
COPY %1 %TUTORCOPY% >nul 2>nul
goto end


At this step, vimtutor.bat can run successfully from "C:\Program Files (x86)\Vim\vim82", i.e. the shortcut. However, I still cannot run the vimtutor.bat script at the command prompt in my home directory, because:

Problem 2: vimtutor.bat does not encode the path of gvim, and the wait behaviour of gvim.bat is different than gvim.exe.

This can be changed by changing gvim to "%~dp0gvim.exe".

start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim"

:: Start gvim without any .vimrc, set 'nocompatible'
start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "set nocp" %TUTORCOPY%

BTW, the -console path requires vim.bat and running from a path other than "C:\Program Files (x86)\Vim\vim82" (if run without the ".bat" suffix). This should not be a problem in daily usage (the quirky behaviour of batch makes solving the problem harder than I expected).

I believe this basically solves the problem, although maybe breaking compatibility with pre-NT Windows. Since the Vim executables already requires Windows 5.1, we can probably eliminate the non-NT paths in the batch file.

Thoughts? If it is OK, I can provide a patch/PR.

Yongwei Wu

You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit

You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit