pi_getscript.txt 21 KB

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