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