Mercurial > vim
annotate src/vimtutor @ 16150:b23048205589 v8.1.1080
patch 8.1.1080: when a screendump test fails, moving the file is a hassle
commit https://github.com/vim/vim/commit/ef7f0e367eeaf6fb31b1caa0e3de1a4b07e86af3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 30 15:59:51 2019 +0100
patch 8.1.1080: when a screendump test fails, moving the file is a hassle
Problem: When a screendump test fails, moving the file is a hassle.
Solution: Instead of appending ".failed" to the file name, keep the same
file name but put the screendump in the "failed" directory.
Then the file name only needs to be typed once when moving a
screendump.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 Mar 2019 16:00:06 +0100 |
parents | 5eac31544dd0 |
children | d4faa2c5211b |
rev | line source |
---|---|
7 | 1 #! /bin/sh |
2 | |
3 # Start Vim on a copy of the tutor file. | |
4 | |
1582 | 5 # Usage: vimtutor [-g] [xx] |
6 # Where optional argument -g starts vimtutor in gvim (GUI) instead of vim. | |
7 # and xx is a language code like "es" or "nl". | |
7 | 8 # When an argument is given, it tries loading that tutor. |
9 # When this fails or no argument was given, it tries using 'v:lang' | |
10 # When that also fails, it uses the English version. | |
11 | |
1582 | 12 # Vim could be called "vim" or "vi". Also check for "vimN", for people who |
13 # have Vim installed with its version number. | |
10214
3a6b2d4c71d6
commit https://github.com/vim/vim/commit/bbe917d9d465a66a29e38879c7f66df51b0b0dc3
Christian Brabandt <cb@256bit.org>
parents:
1582
diff
changeset
|
14 # We anticipate up to a future Vim 8.1 version :-). |
3a6b2d4c71d6
commit https://github.com/vim/vim/commit/bbe917d9d465a66a29e38879c7f66df51b0b0dc3
Christian Brabandt <cb@256bit.org>
parents:
1582
diff
changeset
|
15 seq="vim vim81 vim80 vim8 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi" |
1582 | 16 if test "$1" = "-g"; then |
17 # Try to use the GUI version of Vim if possible, it will fall back | |
18 # on Vim if Gvim is not installed. | |
10214
3a6b2d4c71d6
commit https://github.com/vim/vim/commit/bbe917d9d465a66a29e38879c7f66df51b0b0dc3
Christian Brabandt <cb@256bit.org>
parents:
1582
diff
changeset
|
19 seq="gvim gvim81 gvim80 gvim8 gvim74 gvim73 gvim72 gvim71 gvim70 gvim7 gvim6 $seq" |
1582 | 20 shift |
21 fi | |
22 | |
7 | 23 xx=$1 |
24 export xx | |
25 | |
26 # We need a temp file for the copy. First try using a standard command. | |
27 tmp="${TMPDIR-/tmp}" | |
28 TUTORCOPY=`mktemp $tmp/tutorXXXXXX || tempfile -p tutor || echo none` | |
29 | |
30 # If the standard commands failed then create a directory to put the copy in. | |
31 # That is a secure way to make a temp file. | |
32 if test "$TUTORCOPY" = none; then | |
33 tmpdir=$tmp/vimtutor$$ | |
34 OLD_UMASK=`umask` | |
35 umask 077 | |
36 getout=no | |
37 mkdir $tmpdir || getout=yes | |
38 umask $OLD_UMASK | |
39 if test $getout = yes; then | |
40 echo "Could not create directory for tutor copy, exiting." | |
41 exit 1 | |
42 fi | |
43 TUTORCOPY=$tmpdir/tutorcopy | |
44 touch $TUTORCOPY | |
45 TODELETE=$tmpdir | |
46 else | |
47 TODELETE=$TUTORCOPY | |
48 fi | |
49 | |
50 export TUTORCOPY | |
51 | |
52 # remove the copy of the tutor on exit | |
53 trap "rm -rf $TODELETE" 0 1 2 3 9 11 13 15 | |
54 | |
1316 | 55 for i in $seq; do |
56 testvim=`which $i 2>/dev/null` | |
7 | 57 if test -f "$testvim"; then |
1316 | 58 VIM=$i |
59 break | |
7 | 60 fi |
1316 | 61 done |
62 | |
63 # When no Vim version was found fall back to "vim", you'll get an error message | |
64 # below. | |
65 if test -z "$VIM"; then | |
66 VIM=vim | |
7 | 67 fi |
68 | |
69 # Use Vim to copy the tutor, it knows the value of $VIMRUNTIME | |
70 # The script tutor.vim tells Vim which file to copy | |
1582 | 71 $VIM -f -u NONE -c 'so $VIMRUNTIME/tutor/tutor.vim' |
7 | 72 |
13662
5eac31544dd0
patch 8.0.1703: in the tutor 'showcmd' is not set
Christian Brabandt <cb@256bit.org>
parents:
10214
diff
changeset
|
73 # Start vim without any .vimrc, set 'nocompatible' and 'showcmd' |
5eac31544dd0
patch 8.0.1703: in the tutor 'showcmd' is not set
Christian Brabandt <cb@256bit.org>
parents:
10214
diff
changeset
|
74 $VIM -f -u NONE -c "set nocp showcmd" $TUTORCOPY |