blob: 8d4e4719c0c994c46c65b6de7fd1e0ae04cf15c0 [file] [log] [blame]
Bram Moolenaar7f036442010-08-15 15:24:20 +02001*pi_getscript.txt* For Vim version 7.3. Last change: 2009 Oct 14
Bram Moolenaar9964e462007-05-05 17:54:07 +00002>
3 GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr.
4<
5Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
6 (remove NOSPAM from the email address)
7 *GetLatestVimScripts-copyright*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01008Copyright: (c) 2004-2009 by Charles E. Campbell, Jr. *glvs-copyright*
Bram Moolenaar9964e462007-05-05 17:54:07 +00009 The VIM LICENSE applies to getscript.vim and
10 pi_getscript.txt (see |copyright|) except use
11 "getscript" instead of "Vim". No warranty, express or implied.
12 Use At-Your-Own-Risk.
13
14Getscript is a plugin that simplifies retrieval of the latest versions of the
15scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will
16then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
17get the latest versions of scripts listed therein from http://vim.sf.net/.
18
19==============================================================================
201. Contents *glvs-contents* *glvs* *getscript*
21 *GetLatestVimScripts*
22
23 1. Contents........................................: |glvs-contents|
24 2. GetLatestVimScripts -- Getting Started..........: |glvs-install|
25 3. GetLatestVimScripts Usage.......................: |glvs-usage|
26 4. GetLatestVimScripts Data File...................: |glvs-data|
27 5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins|
28 6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall|
29 7. GetLatestViMScripts Options.....................: |glvs-options|
30 8. GetLatestVimScripts Algorithm...................: |glvs-alg|
31 9. GetLatestVimScripts History.....................: |glvs-hist|
32
33
34==============================================================================
352. GetLatestVimScripts -- Getting Started *getscript-start*
36 *getlatestvimscripts-install*
37
38 VERSION FROM VIM DISTRIBUTION *glvs-dist-install*
39
40Vim 7.0 does not include the GetLatestVimScripts.dist file which
41serves as an example and a template. So, you'll need to create
42your own! See |GetLatestVimScripts_dat|.
43
44 VERSION FROM VIM SF NET *glvs-install*
45
46NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist
47file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for
48the first time.
49
50The GetLatestVimScripts.dist file serves as an example and a template for your
51own personal list. Feel free to remove all the scripts mentioned within it;
52the "important" part of it is the first two lines.
53
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +010054Your computer needs to have wget or curl for GetLatestVimScripts to do its work.
Bram Moolenaar9964e462007-05-05 17:54:07 +000055
56 1. if compressed: gunzip getscript.vba.gz
57 2. Unix:
58 vim getscript.vba
59 :so %
60 :q
61 cd ~/.vim/GetLatest
62 mv GetLatestVimScripts.dist GetLatestVimScripts.dat
63 (edit GetLatestVimScripts.dat to install your own personal
64 list of desired plugins -- see |GetLatestVimScripts_dat|)
65
66 3. Windows:
67 vim getscript.vba
68 :so %
69 :q
70 cd **path-to-vimfiles**/GetLatest
71 mv GetLatestVimScripts.dist GetLatestVimScripts.dat
72 (edit GetLatestVimScripts.dat to install your own personal
73 list of desired plugins -- see |GetLatestVimScripts_dat|)
74
75
76==============================================================================
773. GetLatestVimScripts Usage *glvs-usage* *:GLVS*
78
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +010079Unless it has been defined elsewhere, >
Bram Moolenaar9964e462007-05-05 17:54:07 +000080 :GLVS
81will invoke GetLatestVimScripts(). If some other plugin has defined that
82command, then you may type
83>
84 :GetLatestVimScripts
85<
86The script will attempt to update and, if permitted, will automatically
87install scripts from http://vim.sourceforge.net/. To do so it will peruse a
88file,
89>
90 .vim/GetLatest/GetLatestVimScripts.dat (unix)
91<
92or >
93 ..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
94(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
95directory (see |glvs-plugins|).
96
97Scripts which have been downloaded will appear in the
98~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows)
99subdirectory. GetLatestVimScripts will attempt to automatically
100install them if you have the following line in your <.vimrc>: >
101
102 let g:GetLatestVimScripts_allowautoinstall=1
103
104The <GetLatestVimScripts.dat> file will be automatically be updated to
105reflect the latest version of script(s) so downloaded.
106(also see |glvs-options|)
107
108
109==============================================================================
1104. GetLatestVimScripts Data File *getscript-data* *glvs-data*
111 *:GetLatestVimScripts_dat*
112The data file <GetLatestVimScripts.dat> must have for its first two lines
113the following text:
114>
115 ScriptID SourceID Filename
116 --------------------------
117<
118Following those two lines are three columns; the first two are numeric
119followed by a text column. The GetLatest/GetLatestVimScripts.dist file
120contains an example of such a data file. Anything following a #... is
121ignored, so you may embed comments in the file.
122
123The first number on each line gives the script's ScriptID. When you're about
124to use a web browser to look at scripts on http://vim.sf.net/, just before you
125click on the script's link, you'll see a line resembling
126
127 http://vim.sourceforge.net/scripts/script.php?script_id=40
128
129The "40" happens to be a ScriptID that GetLatestVimScripts needs to
130download the associated page.
131
132The second number on each line gives the script's SourceID. The SourceID
133records the count of uploaded scripts as determined by vim.sf.net; hence it
134serves to indicate "when" a script was uploaded. Setting the SourceID to 1
135insures that GetLatestVimScripts will assume that the script it has is
136out-of-date.
137
138The SourceID is extracted by GetLatestVimScripts from the script's page on
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100139vim.sf.net; whenever it is greater than the one stored in the
Bram Moolenaar9964e462007-05-05 17:54:07 +0000140GetLatestVimScripts.dat file, the script will be downloaded
141(see |GetLatestVimScripts_dat|).
142
143If your script's author has included a special comment line in his/her plugin,
144the plugin itself will be used by GetLatestVimScripts to build your
145<GetLatestVimScripts.dat> file, including any dependencies on other scripts it
146may have. As an example, consider: >
147
148 " GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
149
150This comment line tells getscript.vim to check vimscript #884 and that the
151script is automatically installable. Getscript will also use this line to
152help build the GetLatestVimScripts.dat file, by including a line such as: >
153
154 884 1 AutoAlign.vim
155<
156in it an AutoAlign.vim line isn't already in GetLatestVimScripts.dat file.
157See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a
158comprehensive ability to keep your plugins up-to-date!
159
160 *GetLatestVimScripts_dat*
161As an example of a <GetLatestVimScripts.dat> file:
162>
163 ScriptID SourceID Filename
164 --------------------------
165 294 1 Align.vim
166 120 2 decho.vim
167 40 3 DrawIt.tar.gz
168 451 4 EasyAccents.vim
169 195 5 engspchk.vim
170 642 6 GetLatestVimScripts.vim
171 489 7 Manpageview.vim
172<
173Note: the first two lines are required, but essentially act as comments.
174
175
176==============================================================================
1775. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins*
178
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100179 (this section is for plugin authors)~
180
Bram Moolenaar9964e462007-05-05 17:54:07 +0000181If a plugin author includes the following comment anywhere in their plugin,
182GetLatestVimScripts will find it and use it to automatically build the user's
183GetLatestVimScripts.dat files:
184>
185 src_id
186 v
187 " GetLatestVimScripts: ### ### yourscriptname
188 ^
189 scriptid
190<
191As an author, you should include such a line in to refer to your own script
192plus any additional lines describing any plugin dependencies it may have.
193Same format, of course!
194
195If your command is auto-installable (see |glvs-autoinstall|), and most scripts
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100196are, then you may include :AutoInstall: just before "yourscriptname":
197>
198 src_id
199 v
200 " GetLatestVimScripts: ### ### :AutoInstall: yourscriptname
201 ^
202 scriptid
203<
204NOTE: :AutoInstall: is a plugin-author option, not a GetLatestVimScripts.dat~
205 entry!~
Bram Moolenaar9964e462007-05-05 17:54:07 +0000206
207GetLatestVimScripts commands for those scripts are then appended, if not
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100208already present, to the user's GetLatest/GetLatestVimScripts.dat file. It is
209a relatively painless way to automate the acquisition of any scripts your
Bram Moolenaar9964e462007-05-05 17:54:07 +0000210plugins depend upon.
211
212Now, as an author, you probably don't want GetLatestVimScripts to download
213your own scripts for you yourself, thereby overwriting your not-yet-released
214hard work. GetLatestVimScripts provides a solution for this: put
215>
216 0 0 yourscriptname
217<
218into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip
219examining the "yourscriptname" scripts for those GetLatestVimScripts comment
220lines. As a result, those lines won't be inadvertently installed into your
221<GetLatestVimScripts.dat> file and subsequently used to download your own
222scripts. This is especially important to do if you've included the
223:AutoInstall: option.
224
225Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
226as you've used in your GetLatestVimScripts comment!
227
228
229==============================================================================
2306. GetLatestVimScripts AutoInstall *getscript-autoinstall*
231 *glvs-autoinstall*
232
233GetLatestVimScripts now supports "AutoInstall". Not all scripts are
234supportive of auto-install, as they may have special things you need to do to
235install them (please refer to the script's "install" directions). On the
236other hand, most scripts will be auto-installable.
237
238To let GetLatestVimScripts do an autoinstall, the data file's comment field
239should begin with (surrounding blanks are ignored): >
240
241 :AutoInstall:
242<
243Both colons are needed, and it should begin the comment (yourscriptname)
244field.
245
246One may prevent any autoinstalling by putting the following line in your
247<.vimrc>: >
248
249 let g:GetLatestVimScripts_allowautoinstall= 0
250<
251With :AutoInstall: enabled, as it is by default, files which end with
252
253 ---.tar.bz2 : decompressed & untarred in .vim/ directory
254 ---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
255 ---.vim.bz2 : decompressed & moved into .vim/plugin directory
256 ---.tar.gz : decompressed & untarred in .vim/ directory
257 ---.vba.gz : decompressed in .vim/ directory, then vimball handles it
258 ---.vim.gz : decompressed & moved into .vim/plugin directory
259 ---.vba : unzipped in .vim/ directory
260 ---.vim : moved to .vim/plugin directory
261 ---.zip : unzipped in .vim/ directory
262
263and which merely need to have their components placed by the untar/gunzip or
264move-to-plugin-directory process should be auto-installable. Vimballs, of
265course, should always be auto-installable.
266
267When is a script not auto-installable? Let me give an example:
268
269 .vim/after/syntax/blockhl.vim
270
271The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
272available at:
273
274 http://vim.sourceforge.net/scripts/script.php?script_id=104
275
276Currently, vim's after/syntax only supports by-filetype scripts (in
277blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would
278possibly overwrite the current user's after/syntax/c.vim file.
279
280In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
281allow a after/syntax/c/ directory:
282
283 http://vim.sourceforge.net/scripts/script.php?script_id=1023
284
285The script allows multiple syntax files to exist separately in the
286after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an
287appropriate tarball for auto-install because of the potential for the
288after/syntax/c.vim contained in it to overwrite a user's c.vim.
289
290
291==============================================================================
2927. GetLatestVimScripts Options *glvs-options*
293>
294 g:GetLatestVimScripts_wget
295< default= "wget"
296 This variable holds the name of the command for obtaining
297 scripts.
298>
299 g:GetLatestVimScripts_options
300< default= "-q -O"
301 This variable holds the options to be used with the
302 g:GetLatestVimScripts_wget command.
303>
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100304 g:GetLatestVimScripts_allowautoinstall
Bram Moolenaar9964e462007-05-05 17:54:07 +0000305< default= 1
306 This variable indicates whether GetLatestVimScripts is allowed
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100307 to attempt to automatically install scripts. Furthermore, the
308 plugin author has to have explicitly indicated that his/her
309 plugin is automatically installable (via the :AutoInstall:
310 keyword in the GetLatestVimScripts comment line).
311>
312 g:GetLatestVimScripts_autoinstalldir
313< default= $HOME/.vim (linux)
314 default= $HOME/vimfiles (windows)
315 Override where :AutoInstall: scripts will be installed.
316 Doesn't override vimball installation.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000317
318==============================================================================
3198. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
320
321The Vim sourceforge page dynamically creates a page by keying off of the
322so-called script-id. Within the webpage of
323
324 http://vim.sourceforge.net/scripts/script.php?script_id=40
325
326is a line specifying the latest source-id (src_id). The source identifier
327numbers are always increasing, hence if the src_id is greater than the one
Bram Moolenaar7263a772007-05-10 17:35:54 +0000328recorded for the script in GetLatestVimScripts then it's time to download a
Bram Moolenaar9964e462007-05-05 17:54:07 +0000329newer copy of that script.
330
331GetLatestVimScripts will then download the script and update its internal
332database of script ids, source ids, and scriptnames.
333
334The AutoInstall process will:
335
336 Move the file from GetLatest/ to the following directory
337 Unix : $HOME/.vim
338 Windows: $HOME\vimfiles
339 if the downloaded file ends with ".bz2"
340 bunzip2 it
341 else if the downloaded file ends with ".gz"
342 gunzip it
343 if the resulting file ends with ".zip"
344 unzip it
345 else if the resulting file ends with ".tar"
346 tar -oxvf it
347 else if the resulting file ends with ".vim"
348 move it to the plugin subdirectory
349
350
351==============================================================================
3529. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
353
Bram Moolenaarc236c162008-07-13 17:41:49 +0000354v31 Jun 29, 2008 : * (Bill McCarthy) fixed having hls enabled with getscript
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100355 * (David Schaefer) the acd option interferes with vimballs
356 Solution: bypass the acd option
Bram Moolenaarc236c162008-07-13 17:41:49 +0000357v30 Jun 13, 2008 : * GLVS now checks for existence of fnameescape() and will
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100358 issue an error message if it is not supported
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000359v29 Jan 07, 2008 : * Bram M pointed out that cpo is a global option and that
360 getscriptPlugin.vim was setting it but not restoring it.
361v28 Jan 02, 2008 : * improved shell quoting character handling, cygwin
362 interface, register-a bypass
363 Oct 29, 2007 * Bill McCarthy suggested a change to getscript that avoids
364 creating pop-up windows
Bram Moolenaar7263a772007-05-10 17:35:54 +0000365v24 Apr 16, 2007 : * removed save&restore of the fo option during script
366 loading
Bram Moolenaar9964e462007-05-05 17:54:07 +0000367v23 Nov 03, 2006 : * ignores comments (#...)
368 * handles vimballs
369v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
370 available
371v21 May 01, 2006 : * now takes advantage of autoloading.
372v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
373 unzip needs the -o flag to overwrite.
374v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
375 script! Fixed.
376v18 Mar 21, 2005 : * bugfix to automatic database construction
377 * bugfix - nowrapscan caused an error
378 (tnx to David Green for the fix)
379 Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
380 :AutoInstall:s, even though its o/s is windows
381 Apr 01, 2005 * when downloading errors occurred, GLVS was
382 terminating early. It now just goes on to trying
383 the next script (after trying three times to
384 download a script description page)
385 Apr 20, 2005 * bugfix - when a failure to download occurred,
386 GetLatestVimScripts would stop early and claim that
387 everything was current. Fixed.
388v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
389 defaults to 1, can be used to prevent all
390 :AutoInstall:
391v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
392 * fixed bug with :AutoInstall: use of helptags
393v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
394 always preventing downloads (just usually). Fixed.
395v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
396 s:dotvim. Fixed.
397v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
398 is zero. Useful for script authors; that way their
399 own GetLatestVimScripts activity won't overwrite
400 their scripts.
401v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
402 was intended only for testing. Removed, now works.
403 * :AutoInstall: implemented
404v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
405 * :GetLatestVimScripts command
406 * (runtimepath)/GetLatest/GetLatestVimScripts.dat
407 now holds scripts that need updating
408v10 Apr 19, 2004 : * moved history from script to doc
409v9 Jan 23, 2004 : windows (win32/win16/win95) will use
410 double quotes ("") whereas other systems will use
411 single quotes ('') around the urls in calls via wget
412v8 Dec 01, 2003 : makes three tries at downloading
413v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
414 not found in downloaded webpage
415 Uses t_ti, t_te, and rs to make progress visible
416v6 Aug 06, 2003 : final status messages now display summary of work
417 ( "Downloaded someqty scripts" or
418 "Everything was current")
419 Now GetLatestVimScripts is careful about downloading
420 GetLatestVimScripts.vim itself!
421 (goes to <NEW_GetLatestVimScripts.vim>)
422v5 Aug 04, 2003 : missing an endif near bottom
423v4 Jun 17, 2003 : redraw! just before each "considering" message
424v3 May 27, 2003 : Protects downloaded files from errant shell
425 expansions with single quotes: '...'
426v2 May 14, 2003 : extracts name of item to be obtained from the
427 script file. Uses it instead of comment field
428 for output filename; comment is used in the
429 "considering..." line and is now just a comment!
430 * Fixed a bug: a string-of-numbers is not the
431 same as a number, so I added zero to them
432 and they became numbers. Fixes comparison.
433
434==============================================================================
435vim:tw=78:ts=8:ft=help:fdm=marker