Bram Moolenaar | 76b92b2 | 2006-03-24 22:46:53 +0000 | [diff] [blame] | 1 | *getscript.txt* For Vim version 7.0b. Last change: 2006 Mar 24 |
| 2 | |
| 3 | Get the Latest VimScripts |
Bram Moolenaar | 433f7c8 | 2006-03-21 21:29:36 +0000 | [diff] [blame] | 4 | |
| 5 | Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz> |
| 6 | (remove NOSPAM from the email address) |
| 7 | *GetLatestVimScripts-copyright* |
| 8 | Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. |
| 9 | The VIM LICENSE applies to GetLatestVimScripts.vim and |
| 10 | GetLatestVimScripts.txt (see |copyright|) except use |
| 11 | "GetLatestVimScripts" instead of "Vim". |
| 12 | No warranty, express or implied. Use At-Your-Own-Risk. |
| 13 | |
| 14 | |
| 15 | ============================================================================== |
| 16 | 1. Contents *glvs-contents* |
| 17 | |
| 18 | 1. Contents.......................................: |glvs-contents| |
| 19 | 2. GetLatestVimScripts Usage......................: |glvs| |
| 20 | 3. GetLatestVimScripts Data File..................: |glvs-data| |
| 21 | 4. GetLatestVimScripts Plugins....................: |glvs-plugins| |
| 22 | 5. GetLatestVimScripts AutoInstall................: |glvs-autoinstall| |
| 23 | 6. GetLatestVimScripts Algorithm..................: |glvs-alg| |
| 24 | 7. GetLatestVimScripts History....................: |glvs-hist| |
| 25 | |
| 26 | |
| 27 | ============================================================================== |
Bram Moolenaar | 76b92b2 | 2006-03-24 22:46:53 +0000 | [diff] [blame] | 28 | 2. GetLatestVimScripts Usage *getlatestvimscripts* *getscript* *glvs* |
Bram Moolenaar | 433f7c8 | 2006-03-21 21:29:36 +0000 | [diff] [blame] | 29 | |
| 30 | While in vim, type |
| 31 | > |
| 32 | :GetLatestVimScripts |
| 33 | < |
| 34 | Unless its been defined elsewhere, |
| 35 | > |
| 36 | :GLVS |
| 37 | < |
| 38 | will also work. |
| 39 | |
| 40 | The script will attempt to update and, if so directed, automatically |
| 41 | install scripts from http://vim.sourceforge.net/. To do so it will |
| 42 | peruse a file, [.vim|vimfiles]/GetLatest/GetLatestVimScripts.dat |
| 43 | (see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin |
| 44 | directory (see |glvs-plugins|). |
| 45 | |
| 46 | Scripts which have been downloaded will appear in the .../GetLatest |
| 47 | subdirectory. |
| 48 | |
| 49 | The <GetLatestVimScripts.dat> file will be automatically be updated to |
| 50 | reflect the latest version of script(s) so downloaded. |
| 51 | |
| 52 | |
| 53 | ============================================================================== |
| 54 | 3. GetLatestVimScripts Data File *getlatestvimscripts-data* *glvs-data* |
| 55 | |
| 56 | The Data file has a header which should appear as: |
| 57 | > |
| 58 | ScriptID SourceID Filename |
| 59 | -------------------------- |
| 60 | < |
| 61 | Below that are three columns; the first two are numeric followed by a |
| 62 | text column. |
| 63 | |
| 64 | The first number on each line gives the script's ScriptID. When |
| 65 | you're about to use a web browser to look at scripts on |
| 66 | http://vim.sf.net/, just before you click on the script's link, you'll |
| 67 | see a line resembling |
| 68 | |
| 69 | http://vim.sourceforge.net/scripts/script.php?script_id=40 |
| 70 | |
| 71 | The "40" happens to be a ScriptID that GetLatestVimScripts needs to |
| 72 | download the associated page. |
| 73 | |
| 74 | The second number on each line gives the script's SourceID. The |
| 75 | SourceID records the count of uploaded scripts as determined by |
| 76 | vim.sf.net; hence it serves to indicate "when" a script was uploaded. |
| 77 | Setting the SourceID to 1 insures that GetLatestVimScripts will assume |
| 78 | that the script it has is out-of-date. |
| 79 | |
| 80 | The SourceID is extracted by GetLatestVimScripts from the script's |
| 81 | page on vim.sf.net; whenever its greater than the one stored in the |
| 82 | GetLatestVimScripts.dat file, the script will be downloaded. |
| 83 | |
| 84 | If your script's author has included a special comment line in his/her |
| 85 | plugin, the plugin itself will be used by GetLatestVimScripts to build |
| 86 | your <GetLatestVimScripts.dat> file, including any dependencies on |
| 87 | other scripts it may have. |
| 88 | |
| 89 | If your comment field begins with :AutoInstall:, GetLatestVimScripts |
| 90 | will attempt to automatically install the script. Thus, |
| 91 | GetLatestVimScripts thus provides a comprehensive ability to keep your |
| 92 | plugins up-to-date! |
| 93 | |
| 94 | ============================================================================== |
| 95 | 4. GetLatestVimScripts Plugins *getlatestvimscripts-plugins* *glvs-plugins* |
| 96 | |
| 97 | |
| 98 | If a plugin author includes the following comment anywhere in their |
| 99 | plugin, GetLatestVimScripts will find it and use it to build user's |
| 100 | GetLatestVimScripts.dat files: |
| 101 | > |
| 102 | src_id |
| 103 | v |
| 104 | " GetLatestVimScripts: ### ### yourscriptname |
| 105 | ^ |
| 106 | scriptid |
| 107 | < |
| 108 | As an author, you should include such a line in to refer to your own |
| 109 | script plus any additional lines describing any plugin dependencies it |
| 110 | may have. Same format, of course! |
| 111 | |
| 112 | If your command is auto-installable (see |glvs-autoinstall|), and most |
| 113 | scripts are, then you may include :AutoInstall: at the start of |
| 114 | "yourscriptname". |
| 115 | |
| 116 | GetLatestVimScript commands for those scripts are then appended, if |
| 117 | not already present, to the user's GetLatest/GetLatestVimScripts.dat |
| 118 | file. Its a relatively painless way to automate the acquisition of |
| 119 | any scripts your plugins depend upon. |
| 120 | |
| 121 | Now, as an author, you probably don't want GetLatestVimScripts to |
| 122 | download your own scripts for you yourself, thereby overwriting your |
| 123 | not-yet-released hard work. GetLatestVimScripts provides a solution |
| 124 | for this: put |
| 125 | > |
| 126 | 0 0 yourscriptname |
| 127 | < |
| 128 | into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will |
| 129 | skip examining the "yourscriptname" scripts for those |
| 130 | GetLatestVimScript comment lines. As a result, those lines won't be |
| 131 | inadvertently installed into your <GetLatestVimScripts.dat> file and |
| 132 | subsequently used to download your own scripts. This is especially |
| 133 | important to do if you've included the :AutoInstall: option. |
| 134 | |
| 135 | Be certain to use the same "yourscriptname" in the "0 0 |
| 136 | yourscriptname" line as you've used in your GetLatestVimScript |
| 137 | comment! |
| 138 | |
| 139 | |
| 140 | ============================================================================== |
| 141 | 5. GetLatestVimScripts AutoInstall *getlatestvimscripts-autoinstall* |
| 142 | *glvs-autoinstall* |
| 143 | |
| 144 | GetLatestVimScripts now supports "AutoInstall". Not all scripts are |
| 145 | supportive of auto-install, as they may have special things you need |
| 146 | to do to install them (please refer to the script's "install" |
| 147 | directions). On the other hand, most scripts will be |
| 148 | auto-installable. |
| 149 | |
| 150 | To let GetLatestVimScripts do an autoinstall, the data file's comment |
| 151 | field should begin with (surrounding blanks are ignored): |
| 152 | |
| 153 | :AutoInstall: |
| 154 | |
| 155 | Both colons are needed, and it should begin the comment |
| 156 | (yourscriptname) field. |
| 157 | |
| 158 | One may prevent any autoinstalling by putting the following line |
| 159 | in your <.vimrc>: |
| 160 | > |
| 161 | let g:GetLatestVimScripts_allowautoinstall= 0 |
| 162 | < |
| 163 | |
| 164 | With :AutoInstall: enabled, as it is by default, files which end with |
| 165 | |
| 166 | ---.tar.bz2 : decompressed and untarred in [.vim|vimfiles] directory |
| 167 | ---.tar.gz : decompressed and untarred in [.vim|vimfiles] directory |
| 168 | ---.vim.bz2 : decompressed and moved to the .vim/plugin directory |
| 169 | ---.vim.gz : decompressed and moved to the .vim/plugin directory |
| 170 | ---.zip : unzipped in [.vim|vimfiles] directory |
| 171 | ---.vim : moved to [.vim|vimfiles]/plugin directory |
| 172 | |
| 173 | and which merely need to have their components placed by the |
| 174 | untar/gunzip or move-to-plugin-directory process should be |
| 175 | auto-installable. |
| 176 | |
| 177 | When is a script not auto-installable? Let me give an example: |
| 178 | > |
| 179 | [.vim|vimfiles]/after/syntax/blockhl.vim |
| 180 | < |
| 181 | The <blockhl.vim> script provides block highlighting for C/C++ |
| 182 | programs; it is available at: |
| 183 | > |
| 184 | http://vim.sourceforge.net/scripts/script.php?script_id=104 |
| 185 | < |
| 186 | Currently, vim's after/syntax only supports by-filetype scripts (in |
| 187 | blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install |
| 188 | would possibly overwrite the current user's after/syntax/c.vim file. |
| 189 | |
| 190 | In my own case, I use <aftersyntax.vim> (renamed to |
| 191 | after/syntax/c.vim) to allow a after/syntax/c/ directory: |
| 192 | > |
| 193 | http://vim.sourceforge.net/scripts/script.php?script_id=1023 |
| 194 | < |
| 195 | The script allows multiple syntax files to exist separately in the |
| 196 | after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and |
| 197 | build an appropriate tarball for auto-install because of the potential |
| 198 | for the after/syntax/c.vim contained in it to overwrite a user's |
| 199 | c.vim. |
| 200 | |
| 201 | |
| 202 | ============================================================================== |
| 203 | 6. GetLatestVimScripts Algorithm *getlatestvimscripts-algorithm* |
| 204 | *glvs-alg* |
| 205 | |
| 206 | The Vim sourceforge page dynamically creates a page by keying off of |
| 207 | the so-called script-id. Within the webpage of |
| 208 | |
| 209 | http://vim.sourceforge.net/scripts/script.php?script_id=40 |
| 210 | |
| 211 | is a line specifying the latest source-id (src_id). The source |
| 212 | identifier numbers are always increasing, hence if the src_id is |
| 213 | greater than the one recorded for the script in GetLatestVimScripts |
| 214 | then its time to download a newer copy of that script. |
| 215 | |
| 216 | GetLatestVimScripts will then download the script and update its |
| 217 | internal database of script ids, source ids, and scriptnames. |
| 218 | |
| 219 | The AutoInstall process will: |
| 220 | |
| 221 | Move the file from GetLatest/ to the following directory |
| 222 | Unix : $HOME/.vim |
| 223 | Windows: $HOME\vimfiles |
| 224 | |
| 225 | if the downloaded file ends with ".bz2" |
| 226 | bunzip2 it |
| 227 | else if the downloaded file ends with ".gz" |
| 228 | gunzip it |
| 229 | if the resulting file ends with ".zip" |
| 230 | unzip it |
| 231 | else if the resulting file ends with ".tar" |
| 232 | tar -oxvf it |
| 233 | else if the resulting file ends with ".vim" |
| 234 | move it to the plugin subdirectory |
| 235 | |
| 236 | |
| 237 | ============================================================================== |
| 238 | 7. GetLatestVimScripts History *getlatestvimscripts-history* *glvs-hist* |
| 239 | |
| 240 | v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use; |
| 241 | unzip needs the -o flag to overwrite. |
| 242 | v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong |
| 243 | script! Fixed. |
| 244 | v18 Mar 21, 2005 : * bugfix to automatic database construction |
| 245 | * bugfix - nowrapscan caused an error |
| 246 | (tnx to David Green for the fix) |
| 247 | Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in |
| 248 | :AutoInstall:s, even though its o/s is windows |
| 249 | Apr 01, 2005 * when downloading errors occurred, GLVS was |
| 250 | terminating early. It now just goes on to trying |
| 251 | the next script (after trying three times to |
| 252 | download a script description page) |
| 253 | Apr 20, 2005 * bugfix - when a failure to download occurred, |
| 254 | GetLatestVimScripts would stop early and claim that |
| 255 | everything was current. Fixed. |
| 256 | v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which |
| 257 | defaults to 1, can be used to prevent all |
| 258 | :AutoInstall: |
| 259 | v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent |
| 260 | * fixed bug with :AutoInstall: use of helptags |
| 261 | v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't |
| 262 | always preventing downloads (just usually). Fixed. |
| 263 | v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than |
| 264 | s:dotvim. Fixed. |
| 265 | v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid |
| 266 | is zero. Useful for script authors; that way their |
| 267 | own GetLatestVimScripts activity won't overwrite |
| 268 | their scripts. |
| 269 | v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that |
| 270 | was intended only for testing. Removed, now works. |
| 271 | * :AutoInstall: implemented |
| 272 | v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin: |
| 273 | * :GetLatestVimScripts command |
| 274 | * (runtimepath)/GetLatest/GetLatestVimScripts.dat |
| 275 | now holds scripts that need updating |
| 276 | v10 Apr 19, 2004 : * moved history from script to doc |
| 277 | v9 Jan 23, 2004 : windows (win32/win16/win95) will use |
| 278 | double quotes ("") whereas other systems will use |
| 279 | single quotes ('') around the urls in calls via wget |
| 280 | v8 Dec 01, 2003 : makes three tries at downloading |
| 281 | v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id=" |
| 282 | not found in downloaded webpage |
| 283 | Uses t_ti, t_te, and rs to make progress visible |
| 284 | v6 Aug 06, 2003 : final status messages now display summary of work |
| 285 | ( "Downloaded someqty scripts" or |
| 286 | "Everything was current") |
| 287 | Now GetLatestVimScripts is careful about downloading |
| 288 | GetLatestVimScripts.vim itself! |
| 289 | (goes to <NEW_GetLatestVimScripts.vim>) |
| 290 | v5 Aug 04, 2003 : missing an endif near bottom |
| 291 | v4 Jun 17, 2003 : redraw! just before each "considering" message |
| 292 | v3 May 27, 2003 : Protects downloaded files from errant shell |
| 293 | expansions with single quotes: '...' |
| 294 | v2 May 14, 2003 : extracts name of item to be obtained from the |
| 295 | script file. Uses it instead of comment field |
| 296 | for output filename; comment is used in the |
| 297 | "considering..." line and is now just a comment! |
| 298 | * Fixed a bug: a string-of-numbers is not the |
| 299 | same as a number, so I added zero to them |
| 300 | and they became numbers. Fixes comparison. |
| 301 | |
| 302 | ============================================================================== |
| 303 | vim:tw=78:ts=8:ft=help |