forked from p-moon/develop-reference-data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetscript.cnx
More file actions
executable file
·273 lines (221 loc) · 11.8 KB
/
getscript.cnx
File metadata and controls
executable file
·273 lines (221 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
*getscript.txt* For Vim version 7.0. 最近更新: 2006年4月
得到最新的 Vim 脚本
译者: Willis
http://vimcdoc.sf.net
Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
(remove NOSPAM from the email address)
*GetLatestVimScripts-copyright*
Copyright: (c) 2004-2005 by Charles E. Campbell, Jr.
The VIM LICENSE applies to GetLatestVimScripts.vim and
GetLatestVimScripts.txt (see |copyright|) except use
"GetLatestVimScripts" instead of "Vim".
No warranty, express or implied. Use At-Your-Own-Risk.
==============================================================================
1. 内容 *glvs-contents*
1. 内容...........................................: |glvs-contents|
2. GetLatestVimScripts 用法.......................: |glvs|
3. GetLatestVimScripts 数据文件...................: |glvs-data|
4. GetLatestVimScripts 插件.......................: |glvs-plugins|
5. GetLatestVimScripts 自动安装...................: |glvs-autoinstall|
6. GetLatestVimScripts 算法.......................: |glvs-alg|
7. GetLatestVimScripts 历史.......................: |glvs-hist|
==============================================================================
2. GetLatestVimScripts 用法 *getlatestvimscripts* *getscript* *glvs*
在 Vim 里,输入
>
:GetLatestVimScripts
<
除非另有定义,以下命令功能相同。
>
:GLVS
<
该脚本试图从 http://vim.sourceforge.net/ 自动更新并,如有要求,为你安
装脚本。为此它会审视 [.vim|vimfiles]/GetLatest/GetLatestVimScripts.dat
数据文件 (见 |glvs-data|) 并检查 [.vim|vimfiles]/plugin 目录里的插件
(见 |glvs-plugins|)。
脚本会下载到 .../GetLatest 子目录。
<GetLatestVimScripts.dat> 文件会自动更新,以反映脚本的最新下载版本。
==============================================================================
3. GetLatestVimScripts 数据文件 *getlatestvimscripts-data* *glvs-data*
该数据文件的头部包含:
>
ScriptID SourceID Filename
--------------------------
<
文件之后的内容包含三列数据,前两列是数值列,然后是一列文本列。
每行第一个数值给出脚本的 ScriptID。如果用浏览器察看 http://vim.sf.net/
里的脚本,点击脚本的链接之前,你会看到该链接的形式如下:
http://vim.sourceforge.net/scripts/script.php?script_id=40
这里 "40" 就是 ScriptID,GetLatestVimScripts 用它来下载相关页面。
每行第二个数值给出脚本的 SourceID。SourceID 记录由 vim.sf.net 决定的脚
本上传次数;这样,它起到了指示脚本 "何时" 上传的作用。设置 SourceID 为
1 就可使 GetLatestVimScripts 认为它拥有的脚本版本已经过时。
GetLatestVimScripts 从 vim.sf.net 的相应脚本页提取 SourceID。一旦该值
大于 GetLatestVimScripts.dat 文件保存的值,该脚本就会被下载。
如果脚本作者在脚本中包含了某特殊注释行,GetLatestVimScripts 会用该脚本
本身和 (如果存在的话) 它依赖的其它脚本来构造 <GetLatestVimScripts.dat>
文件。
如果该注释字段以 :AutoInstall: 开始,GetLatestVimScripts 更会试图自动
安装相应脚本。这样,GetLatestVimScripts 提供了全面的让你脚本随时保持更
新的完整功能!
==============================================================================
4. GetLatestVimScripts 插件 *getlatestvimscripts-plugins* *glvs-plugins*
如果插件作者在插件的任何地方包含了下面形式的注释,GetLatestVimScripts
会找到它并用来构造用户 GetLatestVimScripts.dat 文件:
>
src_id
v
" GetLatestVimScripts: ### ### yourscriptname
^
scriptid
<
作为作者,加上该行就可以引用你自己的脚本,如果需要,也可以附加注释行来
描述依赖的其它脚本。当然,使用相同格式!
多数脚本都可以自动安装。如果你的命令也可以 (见 |glvs-autoinstall|),那
么可在 "yourscriptname" 开始的位置加上 :AutoInstall:。
如果还没有加入的话,此时就会在用户 GetLatest/GetLatestVimScripts.dat
文件里加入这些脚本的 GetLatestVimScript 命令。这是一个相对简单的自动获
取所有你的插件所依赖的脚本的方法。
不过,作为作者,你可能不想让 GetLatestVimScripts 下载你自己的脚本,因
为这样会覆盖你还没有发布的工作。GetLatestVimScripts 提供了解决这个问题
的方法: 把
>
0 0 yourscriptname
<
放入 <GetLatestVimScripts.dat> 文件。这样 GetLatestVimScripts 就会跳过
"yourscriptname" 脚本的 GetLatestVimScript 注释行检查。从而,这些行就
不会加到 <GetLatestVimScripts.dat> 文件里并进而下载你自己的脚本。如果
包含了 :AutoInstall: 选项,这一点尤其重要。
确定 "0 0 yourscriptname" 用的 "yourscriptname" 和 GetLatestVimScript
注释里的相同!
==============================================================================
5. GetLatestVimScripts 自动安装 *getlatestvimscripts-autoinstall*
*glvs-autoinstall*
GetLatestVimScripts 现在支持了 "AutoInstall" (自动安装)。并非所有脚本
都支持自动安装。若干脚本或有特殊的安装需求 (请参阅这些脚本的 "install"
(安装) 指示)。换一角度讲,可以自动安装的脚本还是占多数的。
要让 GetLatestVimScripts 进行自动安装,数据文件的注释域须以下列文字开
始 (前后有空白无妨):
:AutoInstall:
必须给出前后两个冒号,也必须放在注释 (yourscriptname) 域的开始处。
如果你不想进行任何自动安装,在 <.vimrc> 里放入:
>
let g:GetLatestVimScripts_allowautoinstall= 0
<
缺省打开 :AutoInstall:。此时,名字里包含如下后缀的文件会被相应地
---.tar.bz2 : 解压和 untar 解包到 [.vim|vimfiles] 目录
---.tar.gz : 解压和 untar 解包到 [.vim|vimfiles] 目录
---.vim.bz2 : 解压并移到 .vim/plugin 目录
---.vim.gz : 解压并移到 .vim/plugin 目录
---.zip : unzip 解压到 [.vim|vimfiles] 目录
---.vim : 移到 [.vim|vimfiles]/plugin 目录
如果只要通过 untar/gunzip 或 "移到插件目录" 过程来放置各个部件就可以使
用,那么这个脚本就称之为可以自动安装。
什么时候脚本不能自动安装?让我举个例子:
>
[.vim|vimfiles]/after/syntax/blockhl.vim
<
<blockhl.vim> 脚本提供 C/C++ 程序的块高亮;它可以这样得到:
>
http://vim.sourceforge.net/scripts/script.php?script_id=104
<
目前,vim 的 after/syntax 只支持按文件类型命名的脚本 (blockhl.vim 的情
况应该使用 after/syntax/c.vim)。所以,如果使用自动安装,可能会覆盖当前
用户自己的 after/syntax/c.vim 文件。
我自己的例子。我用 <aftersyntax.vim> (换名到 after/syntax/c.vim) 以支
持 after/syntax/c/ 目录:
>
http://vim.sourceforge.net/scripts/script.php?script_id=1023
<
该脚本允许多个语法文件在 after/syntax/c 子目录同时存在。我不能把
aftersyntax.vim 捆绑进来并构造一个合适的自动安装用 tar 包,因为它包含
的 after/syntax/c.vim 可能会覆盖用户自己的 c.vim。
==============================================================================
6. GetLatestVimScripts 算法 *getlatestvimscripts-algorithm*
*glvs-alg*
Vim sourceforge 页面用所谓的 script-id 键动态建立页面。以下网页
http://vim.sourceforge.net/scripts/script.php?script_id=40
指定最新的 source-id (src_id)。该源标识符 (source-id) 总是不断递增,因
此如果 src_id 大于 GetLatestVimScripts 脚本记录的值,那就是时候下载该
脚本的新版本了。
此时,GetLatestVimScripts 下载脚本并更新内部数据库里的 script id、
source id 和 scriptname。
然后,AutoInstall 过程会:
从 GetLatest/ 把文件移动到下面的目录
Unix : $HOME/.vim
Windows: $HOME\vimfiles
如果下载文件以 ".bz2" 结尾
进行 bunzip2 解压
否则如果下载文件以 ".gz" 结尾
进行 gunzip 解压
如果产生的文件以 ".zip" 结尾
进行 unzip 解包
否则如果产生的文件以 ".tar" 结尾
进行 tar -oxvf 解包
否则如果产生的文件以 ".vim" 结尾
把它移动到 plugin 子目录
==============================================================================
7. GetLatestVimScripts 历史 (英文) *getlatestvimscripts-history* *glvs-hist*
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
unzip needs the -o flag to overwrite.
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
script! Fixed.
v18 Mar 21, 2005 : * bugfix to automatic database construction
* bugfix - nowrapscan caused an error
(tnx to David Green for the fix)
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
:AutoInstall:s, even though its o/s is windows
Apr 01, 2005 * when downloading errors occurred, GLVS was
terminating early. It now just goes on to trying
the next script (after trying three times to
download a script description page)
Apr 20, 2005 * bugfix - when a failure to download occurred,
GetLatestVimScripts would stop early and claim that
everything was current. Fixed.
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
defaults to 1, can be used to prevent all
:AutoInstall:
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
* fixed bug with :AutoInstall: use of helptags
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
always preventing downloads (just usually). Fixed.
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
s:dotvim. Fixed.
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
is zero. Useful for script authors; that way their
own GetLatestVimScripts activity won't overwrite
their scripts.
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
was intended only for testing. Removed, now works.
* :AutoInstall: implemented
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
* :GetLatestVimScripts command
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
now holds scripts that need updating
v10 Apr 19, 2004 : * moved history from script to doc
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
double quotes ("") whereas other systems will use
single quotes ('') around the urls in calls via wget
v8 Dec 01, 2003 : makes three tries at downloading
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
not found in downloaded webpage
Uses t_ti, t_te, and rs to make progress visible
v6 Aug 06, 2003 : final status messages now display summary of work
( "Downloaded someqty scripts" or
"Everything was current")
Now GetLatestVimScripts is careful about downloading
GetLatestVimScripts.vim itself!
(goes to <NEW_GetLatestVimScripts.vim>)
v5 Aug 04, 2003 : missing an endif near bottom
v4 Jun 17, 2003 : redraw! just before each "considering" message
v3 May 27, 2003 : Protects downloaded files from errant shell
expansions with single quotes: '...'
v2 May 14, 2003 : extracts name of item to be obtained from the
script file. Uses it instead of comment field
for output filename; comment is used in the
"considering..." line and is now just a comment!
* Fixed a bug: a string-of-numbers is not the
same as a number, so I added zero to them
and they became numbers. Fixes comparison.
==============================================================================
vim:tw=78:ts=8:ft=help