annotate runtime/tutor/tutor.vim @ 19490:ac68906da0ae

Added tag v8.2.0302 for changeset 31ac050a29a7dec656bfce3f6529502a84f626d8
author Bram Moolenaar <Bram@vim.org>
date Sat, 22 Feb 2020 23:00:05 +0100
parents c4cdc715cb68
children 71cbad0921c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim tutor support file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Author: Eduardo F. Amatria <eferna1@platea.pntic.mec.es>
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1621
diff changeset
3 " Maintainer: Bram Moolenaar
18615
c4cdc715cb68 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16168
diff changeset
4 " Last Change: 2019 Nov 11
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1621
diff changeset
6 " This Vim script is used for detecting if a translation of the
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " tutor file exist, i.e., a tutor.xx file, where xx is the language.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " If the translation does not exist, or no extension is given,
13735
a62eeee5f116 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 9555
diff changeset
9 " it defaults to the English version.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " It is invoked by the vimtutor shell script.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " 1. Build the extension of the file, if any:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 let s:ext = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 if strlen($xx) > 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 let s:ext = "." . $xx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 let s:lang = ""
782
d20041a02ee5 updated for version 7.0228
vimboss
parents: 557
diff changeset
19 " Check that a potential value has at least two letters.
d20041a02ee5 updated for version 7.0228
vimboss
parents: 557
diff changeset
20 " Ignore "1043" and "C".
d20041a02ee5 updated for version 7.0228
vimboss
parents: 557
diff changeset
21 if exists("v:lang") && v:lang =~ '\a\a'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 let s:lang = v:lang
782
d20041a02ee5 updated for version 7.0228
vimboss
parents: 557
diff changeset
23 elseif $LC_ALL =~ '\a\a'
205
d292c40ca788 updated for version 7.0060
vimboss
parents: 24
diff changeset
24 let s:lang = $LC_ALL
16168
7688bff96a8c patch 8.1.1089: tutor does not check $LC_MESSAGES
Bram Moolenaar <Bram@vim.org>
parents: 14372
diff changeset
25 elseif $LC_MESSAGES =~ '\a\a' || $LC_MESSAGES ==# "C"
7688bff96a8c patch 8.1.1089: tutor does not check $LC_MESSAGES
Bram Moolenaar <Bram@vim.org>
parents: 14372
diff changeset
26 " LC_MESSAGES=C can be used to explicitly ask for English messages while
7688bff96a8c patch 8.1.1089: tutor does not check $LC_MESSAGES
Bram Moolenaar <Bram@vim.org>
parents: 14372
diff changeset
27 " keeping LANG non-English; don't set s:lang then.
7688bff96a8c patch 8.1.1089: tutor does not check $LC_MESSAGES
Bram Moolenaar <Bram@vim.org>
parents: 14372
diff changeset
28 if $LC_MESSAGES =~ '\a\a'
7688bff96a8c patch 8.1.1089: tutor does not check $LC_MESSAGES
Bram Moolenaar <Bram@vim.org>
parents: 14372
diff changeset
29 let s:lang = $LC_MESSAGES
7688bff96a8c patch 8.1.1089: tutor does not check $LC_MESSAGES
Bram Moolenaar <Bram@vim.org>
parents: 14372
diff changeset
30 endif
782
d20041a02ee5 updated for version 7.0228
vimboss
parents: 557
diff changeset
31 elseif $LANG =~ '\a\a'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 let s:lang = $LANG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 if s:lang != ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " Remove "@euro" (ignoring case), it may be at the end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 let s:lang = substitute(s:lang, '\c@euro', '', '')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 " On MS-Windows it may be German_Germany.1252 or Polish_Poland.1250. How
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " about other languages?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 if s:lang =~ "German"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 let s:ext = ".de"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 elseif s:lang =~ "Polish"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 let s:ext = ".pl"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 elseif s:lang =~ "Slovak"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 let s:ext = ".sk"
6009
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
45 elseif s:lang =~ "Serbian"
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
46 let s:ext = ".sr"
1154
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
47 elseif s:lang =~ "Czech"
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
48 let s:ext = ".cs"
782
d20041a02ee5 updated for version 7.0228
vimboss
parents: 557
diff changeset
49 elseif s:lang =~ "Dutch"
d20041a02ee5 updated for version 7.0228
vimboss
parents: 557
diff changeset
50 let s:ext = ".nl"
9555
9560a5b782ee commit https://github.com/vim/vim/commit/42ebd066422d73cdb7bda6a1dc828a3dd022dec8
Christian Brabandt <cb@256bit.org>
parents: 6009
diff changeset
51 elseif s:lang =~ "Bulgarian"
9560a5b782ee commit https://github.com/vim/vim/commit/42ebd066422d73cdb7bda6a1dc828a3dd022dec8
Christian Brabandt <cb@256bit.org>
parents: 6009
diff changeset
52 let s:ext = ".bg"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 let s:ext = "." . strpart(s:lang, 0, 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
59 " Somehow ".ge" (Germany) is sometimes used for ".de" (Deutsch).
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
60 if s:ext =~? '\.ge'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
61 let s:ext = ".de"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
62 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
63
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
64 if s:ext =~? '\.en'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
65 let s:ext = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
66 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
67
14372
2a4a2dc35c55 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
68 " The Japanese tutor is available in three encodings, guess which one to use
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " The "sjis" one is actually "cp932", it doesn't matter for this text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 if s:ext =~? '\.ja'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 if &enc =~ "euc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 let s:ext = ".ja.euc"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
73 elseif &enc != "utf-8"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 let s:ext = ".ja.sjis"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
14372
2a4a2dc35c55 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
78 " The Korean tutor is available in two encodings, guess which one to use
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 if s:ext =~? '\.ko'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
80 if &enc != "utf-8"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 let s:ext = ".ko.euc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3830
04592728474a Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
85 " The Chinese tutor is available in three encodings, guess which one to use
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 " This segment is from the above lines and modified by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 " Mendel L Chan <beos@turbolinux.com.cn> for Chinese vim tutorial
3830
04592728474a Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
88 " When 'encoding' is utf-8, choose between China (simplified) and Taiwan
04592728474a Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
89 " (traditional) based on the language, suggested by Alick Zhao.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 if s:ext =~? '\.zh'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 if &enc =~ 'big5\|cp950'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 let s:ext = ".zh.big5"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
93 elseif &enc != 'utf-8'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 let s:ext = ".zh.euc"
3830
04592728474a Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
95 elseif s:ext =~? 'zh_tw' || (exists("s:lang") && s:lang =~? 'zh_tw')
04592728474a Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
96 let s:ext = ".zh_tw"
04592728474a Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
97 else
04592728474a Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1698
diff changeset
98 let s:ext = ".zh_cn"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 " The Polish tutor is available in two encodings, guess which one to use.
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 7
diff changeset
103 if s:ext =~? '\.pl'
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 7
diff changeset
104 if &enc =~ 1250
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 7
diff changeset
105 let s:ext = ".pl.cp1250"
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 7
diff changeset
106 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108
557
862863033fdd updated for version 7.0158
vimboss
parents: 205
diff changeset
109 " The Turkish tutor is available in two encodings, guess which one to use
862863033fdd updated for version 7.0158
vimboss
parents: 205
diff changeset
110 if s:ext =~? '\.tr'
18615
c4cdc715cb68 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 16168
diff changeset
111 if &enc == "iso-8859-9" || &enc == "cp1254"
557
862863033fdd updated for version 7.0158
vimboss
parents: 205
diff changeset
112 let s:ext = ".tr.iso9"
862863033fdd updated for version 7.0158
vimboss
parents: 205
diff changeset
113 endif
862863033fdd updated for version 7.0158
vimboss
parents: 205
diff changeset
114 endif
862863033fdd updated for version 7.0158
vimboss
parents: 205
diff changeset
115
969
cf4d73a8924e updated for version 7.0-095
vimboss
parents: 953
diff changeset
116 " The Greek tutor is available in three encodings, guess what to use.
cf4d73a8924e updated for version 7.0-095
vimboss
parents: 953
diff changeset
117 " We used ".gr" (Greece) instead of ".el" (Greek); accept both.
cf4d73a8924e updated for version 7.0-095
vimboss
parents: 953
diff changeset
118 if s:ext =~? '\.gr\|\.el'
cf4d73a8924e updated for version 7.0-095
vimboss
parents: 953
diff changeset
119 if &enc == "iso-8859-7"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
120 let s:ext = ".el"
969
cf4d73a8924e updated for version 7.0-095
vimboss
parents: 953
diff changeset
121 elseif &enc == "utf-8"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
122 let s:ext = ".el.utf-8"
969
cf4d73a8924e updated for version 7.0-095
vimboss
parents: 953
diff changeset
123 elseif &enc =~ 737
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
124 let s:ext = ".el.cp737"
969
cf4d73a8924e updated for version 7.0-095
vimboss
parents: 953
diff changeset
125 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127
1154
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
128 " The Slovak tutor is available in three encodings, guess which one to use
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
129 if s:ext =~? '\.sk'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
130 if &enc =~ 1250
1154
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
131 let s:ext = ".sk.cp1250"
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
132 endif
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
133 endif
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
134
6009
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
135 " The Slovak tutor is available in two encodings, guess which one to use
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
136 " Note that the utf-8 version is the original, the cp1250 version is created
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
137 " from it.
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
138 if s:ext =~? '\.sr'
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
139 if &enc =~ 1250
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
140 let s:ext = ".sr.cp1250"
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
141 endif
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
142 endif
7b83c190d370 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3830
diff changeset
143
1154
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
144 " The Czech tutor is available in three encodings, guess which one to use
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
145 if s:ext =~? '\.cs'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
146 if &enc =~ 1250
1154
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
147 let s:ext = ".cs.cp1250"
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
148 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
953
2fb204616c9b updated for version 7.0-079
vimboss
parents: 782
diff changeset
151 " The Russian tutor is available in three encodings, guess which one to use.
2fb204616c9b updated for version 7.0-079
vimboss
parents: 782
diff changeset
152 if s:ext =~? '\.ru'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
153 if &enc =~ '1251'
953
2fb204616c9b updated for version 7.0-079
vimboss
parents: 782
diff changeset
154 let s:ext = '.ru.cp1251'
2fb204616c9b updated for version 7.0-079
vimboss
parents: 782
diff changeset
155 elseif &enc =~ 'koi8'
2fb204616c9b updated for version 7.0-079
vimboss
parents: 782
diff changeset
156 let s:ext = '.ru'
2fb204616c9b updated for version 7.0-079
vimboss
parents: 782
diff changeset
157 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
160 " The Hungarian tutor is available in three encodings, guess which one to use.
1154
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
161 if s:ext =~? '\.hu'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
162 if &enc =~ 1250
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
163 let s:ext = ".hu.cp1250"
1154
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
164 elseif &enc =~ 'iso-8859-2'
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
165 let s:ext = '.hu'
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
166 endif
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
167 endif
f23b876b21ff updated for version 7.1a
vimboss
parents: 969
diff changeset
168
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
169 " The Croatian tutor is available in three encodings, guess which one to use.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
170 if s:ext =~? '\.hr'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
171 if &enc =~ 1250
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
172 let s:ext = ".hr.cp1250"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
173 elseif &enc =~ 'iso-8859-2'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
174 let s:ext = '.hr'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
175 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
178 " If 'encoding' is utf-8 s:ext must end in utf-8.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1154
diff changeset
179 if &enc == 'utf-8' && s:ext !~ '\.utf-8'
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1621
diff changeset
180 let s:ext .= '.utf-8'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 " 2. Build the name of the file:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 let s:tutorfile = "/tutor/tutor"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 let s:tutorxx = $VIMRUNTIME . s:tutorfile . s:ext
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 " 3. Finding the file:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 if filereadable(s:tutorxx)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 let $TUTOR = s:tutorxx
14372
2a4a2dc35c55 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
190 elseif s:ext !~ '\.utf-8' && filereadable(s:tutorxx . ".utf-8")
2a4a2dc35c55 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
191 " Fallback to utf-8 if available.
2a4a2dc35c55 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
192 let $TUTOR = s:tutorxx . ".utf-8"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 let $TUTOR = $VIMRUNTIME . s:tutorfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 echo "The file " . s:tutorxx . " does not exist.\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 echo "Copying English version: " . $TUTOR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 4sleep
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 " 4. Making the copy and exiting Vim:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 e $TUTOR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 wq! $TUTORCOPY