Mercurial > vim
comparison vimtutor.bat @ 19711:831a3f3be6f4 v8.2.0412
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Commit: https://github.com/vim/vim/commit/37f471df6ee422beb4d08ee4ccda35f8279e3bb7
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 19 17:13:40 2020 +0100
patch 8.2.0412: MS-Windows: cannot use vimtutor from the start menu
Problem: MS-Windows: cannot use vimtutor from the start menu.
Solution: Better check for writable directory. Use the right path for the
executable. (Wu Yongwei, closes #5774, closes #5756)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 19 Mar 2020 17:15:04 +0100 |
parents | 1b154b5f247d |
children | d4faa2c5211b |
comparison
equal
deleted
inserted
replaced
19710:49f383f54ee0 | 19711:831a3f3be6f4 |
---|---|
8 :: When an xx argument is given, it tries loading that tutor. | 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' | 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. | 10 :: When that also fails, it uses the English version. |
11 | 11 |
12 :: Use Vim to copy the tutor, it knows the value of $VIMRUNTIME | 12 :: Use Vim to copy the tutor, it knows the value of $VIMRUNTIME |
13 FOR %%d in (. "%TMP%" "%TEMP%") DO IF EXIST %%d\nul SET TUTORCOPY=%%d\$tutor$ | 13 FOR %%d in (. %TMP% %TEMP%) DO ( |
14 call :test_dir_writable %0 %%d | |
15 IF NOT ERRORLEVEL 1 GOTO dir_ok | |
16 ) | |
17 | |
18 echo No working directory is found | |
19 GOTO end | |
20 | |
21 :test_dir_writable | |
22 SET TUTORCOPY=%2\$tutor$ | |
23 COPY %1 %TUTORCOPY% >nul 2>nul | |
24 GOTO end | |
25 | |
26 :dir_ok | |
14 | 27 |
15 SET xx=%1 | 28 SET xx=%1 |
16 | 29 |
17 IF NOT .%1==.-console GOTO use_gui | 30 IF NOT .%1==.-console GOTO use_gui |
18 SHIFT | 31 SHIFT |
23 :: Try making a copy of tutor with gvim. If gvim cannot be found, try using | 36 :: 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 | 37 :: vim instead. If vim cannot be found, alert user to check environment and |
25 :: installation. | 38 :: installation. |
26 | 39 |
27 :: The script tutor.vim tells Vim which file to copy. | 40 :: The script tutor.vim tells Vim which file to copy. |
28 :: For Windows NT "start" works a bit differently. | 41 start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" |
29 IF .%OS%==.Windows_NT GOTO ntaction | |
30 | |
31 start /w gvim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" | |
32 IF ERRORLEVEL 1 GOTO use_vim | 42 IF ERRORLEVEL 1 GOTO use_vim |
33 | 43 |
34 :: Start gvim without any .vimrc, set 'nocompatible' | 44 :: Start gvim without any .vimrc, set 'nocompatible' |
35 start /w gvim -u NONE -c "set nocp" %TUTORCOPY% | 45 start "dummy" /b /w "%~dp0gvim.exe" -u NONE -c "set nocp" %TUTORCOPY% |
36 | |
37 GOTO end | |
38 | |
39 :ntaction | |
40 start "dummy" /b /w gvim -u NONE -c "so $VIMRUNTIME/tutor/tutor.vim" | |
41 IF ERRORLEVEL 1 GOTO use_vim | |
42 | |
43 :: Start gvim without any .vimrc, set 'nocompatible' | |
44 start "dummy" /b /w gvim -u NONE -c "set nocp" %TUTORCOPY% | |
45 | 46 |
46 GOTO end | 47 GOTO end |
47 | 48 |
48 :use_vim | 49 :use_vim |
49 :: The script tutor.vim tells Vim which file to copy | 50 :: The script tutor.vim tells Vim which file to copy |