annotate runtime/autoload/getscript.vim @ 2888:2763fe7844f6

Added tag v7-3-217 for changeset 15705b520c29
author Bram Moolenaar <bram@vim.org>
date Mon, 13 Jun 2011 01:19:56 +0200
parents 7bc41231fbc7
children fd09a9c8468e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
1 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
2 " getscript.vim
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
3 " Author: Charles E. Campbell, Jr.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
4 " Date: Dec 28, 2009
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
5 " Version: 32
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
6 " Installing: :help glvs-install
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
7 " Usage: :help glvs
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
8 "
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
9 " GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
1240
5bed56fce2b5 updated for version 7.1
vimboss
parents: 1197
diff changeset
10 "redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
11 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
12 " Initialization: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
13 " if you're sourcing this file, surely you can't be
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
14 " expecting vim to be in its vi-compatible mode!
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
15 if exists("g:loaded_getscript")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
16 finish
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
17 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
18 let g:loaded_getscript= "v32"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
19 if &cp
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
20 echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
21 finish
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
22 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
23 if v:version < 702
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
24 echohl WarningMsg
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
25 echo "***warning*** this version of getscript needs vim 7.2"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
26 echohl Normal
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
27 finish
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
28 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
29 let s:keepcpo = &cpo
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
30 set cpo&vim
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
31 "DechoTabOn
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
32
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
33 " ---------------------------
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
34 " Global Variables: {{{1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
35 " ---------------------------
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
36 " Cygwin Detection ------- {{{2
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
37 if !exists("g:getscript_cygwin")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
38 if has("win32") || has("win95") || has("win64") || has("win16")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
39 if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
40 let g:getscript_cygwin= 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
41 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
42 let g:getscript_cygwin= 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
43 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
44 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
45 let g:getscript_cygwin= 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
46 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
47 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
48
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
49 " wget vs curl {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
50 if !exists("g:GetLatestVimScripts_wget")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
51 if executable("wget")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
52 let g:GetLatestVimScripts_wget= "wget"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
53 elseif executable("curl")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
54 let g:GetLatestVimScripts_wget= "curl"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
55 else
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
56 let g:GetLatestVimScripts_wget = 'echo "GetLatestVimScripts needs wget or curl"'
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
57 let g:GetLatestVimScripts_options = ""
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
58 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
59 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
60
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
61 " options that wget and curl require:
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
62 if !exists("g:GetLatestVimScripts_options")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
63 if g:GetLatestVimScripts_wget == "wget"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
64 let g:GetLatestVimScripts_options= "-q -O"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
65 elseif g:GetLatestVimScripts_wget == "curl"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
66 let g:GetLatestVimScripts_options= "-s -O"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
67 else
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
68 let g:GetLatestVimScripts_options= ""
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
69 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
70 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
71
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
72 " by default, allow autoinstall lines to work
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
73 if !exists("g:GetLatestVimScripts_allowautoinstall")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
74 let g:GetLatestVimScripts_allowautoinstall= 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
75 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
76
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
77 "" For debugging:
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
78 "let g:GetLatestVimScripts_wget = "echo"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
79 "let g:GetLatestVimScripts_options = "options"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
80
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
81 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
82 " Check If AutoInstall Capable: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
83 let s:autoinstall= ""
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
84 if g:GetLatestVimScripts_allowautoinstall
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
85
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
86 if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
87 " windows (but not cygwin/bash)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
88 let s:dotvim= "vimfiles"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
89 if !exists("g:GetLatestVimScripts_mv")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
90 let g:GetLatestVimScripts_mv= "ren"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
91 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
92
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
93 else
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
94 " unix
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
95 let s:dotvim= ".vim"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
96 if !exists("g:GetLatestVimScripts_mv")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
97 let g:GetLatestVimScripts_mv= "mv"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
98 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
99 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
100
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
101 if exists("g:GetLatestVimScripts_autoinstalldir") && isdirectory(g:GetLatestVimScripts_autoinstalldir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
102 let s:autoinstall= g:GetLatestVimScripts_autoinstalldir"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
103 elseif exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
104 let s:autoinstall= $HOME."/".s:dotvim
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
105 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
106 " call Decho("s:autoinstall<".s:autoinstall.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
107 "else "Decho
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
108 " call Decho("g:GetLatestVimScripts_allowautoinstall=".g:GetLatestVimScripts_allowautoinstall.": :AutoInstall: disabled")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
109 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
110
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
111 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
112 " Public Interface: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
113 com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts()
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
114 com! -nargs=0 GetScript call getscript#GetLatestVimScripts()
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
115 silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts()
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
116
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
117 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
118 " GetLatestVimScripts: this function gets the latest versions of {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
119 " scripts based on the list in
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
120 " (first dir in runtimepath)/GetLatest/GetLatestVimScripts.dat
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
121 fun! getscript#GetLatestVimScripts()
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
122 " call Dfunc("GetLatestVimScripts() autoinstall<".s:autoinstall.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
123
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
124 " insure that wget is executable
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
125 if executable(g:GetLatestVimScripts_wget) != 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
126 echoerr "GetLatestVimScripts needs ".g:GetLatestVimScripts_wget." which apparently is not available on your system"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
127 " call Dret("GetLatestVimScripts : wget not executable/availble")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
128 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
129 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
130
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
131 " insure that fnameescape() is available
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
132 if !exists("*fnameescape")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
133 echoerr "GetLatestVimScripts needs fnameescape() (provided by 7.1.299 or later)"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
134 return
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
135 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
136
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
137 " Find the .../GetLatest subdirectory under the runtimepath
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
138 for datadir in split(&rtp,',') + ['']
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
139 if isdirectory(datadir."/GetLatest")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
140 " call Decho("found directory<".datadir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
141 let datadir= datadir . "/GetLatest"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
142 break
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
143 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
144 if filereadable(datadir."GetLatestVimScripts.dat")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
145 " call Decho("found ".datadir."/GetLatestVimScripts.dat")
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
146 break
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
147 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
148 endfor
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
149
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
150 " Sanity checks: readability and writability
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
151 if datadir == ""
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
152 echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install'
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
153 " call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
154 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
155 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
156 if filewritable(datadir) != 2
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
157 echoerr "(getLatestVimScripts) Your ".datadir." isn't writable"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
158 " call Dret("GetLatestVimScripts : non-writable directory<".datadir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
159 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
160 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
161 let datafile= datadir."/GetLatestVimScripts.dat"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
162 if !filereadable(datafile)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
163 echoerr "Your data file<".datafile."> isn't readable"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
164 " call Dret("GetLatestVimScripts : non-readable datafile<".datafile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
165 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
166 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
167 if !filewritable(datafile)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
168 echoerr "Your data file<".datafile."> isn't writable"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
169 " call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
170 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
171 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
172 " --------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
173 " Passed sanity checks
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
174 " --------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
175
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
176 " call Decho("datadir <".datadir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
177 " call Decho("datafile <".datafile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
178
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
179 " don't let any event handlers interfere (like winmanager's, taglist's, etc)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
180 let eikeep = &ei
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
181 let hlskeep = &hls
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
182 let acdkeep = &acd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
183 set ei=all hls&vim noacd
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
184
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
185 " Edit the datafile (ie. GetLatestVimScripts.dat):
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
186 " 1. record current directory (origdir),
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
187 " 2. change directory to datadir,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
188 " 3. split window
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
189 " 4. edit datafile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
190 let origdir= getcwd()
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
191 " call Decho("exe cd ".fnameescape(substitute(datadir,'\','/','ge')))
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
192 exe "cd ".fnameescape(substitute(datadir,'\','/','ge'))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
193 split
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
194 " call Decho("exe e ".fnameescape(substitute(datafile,'\','/','ge')))
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
195 exe "e ".fnameescape(substitute(datafile,'\','/','ge'))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
196 res 1000
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
197 let s:downloads = 0
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
198 let s:downerrors= 0
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
199
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
200 " Check on dependencies mentioned in plugins
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
201 " call Decho(" ")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
202 " call Decho("searching plugins for GetLatestVimScripts dependencies")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
203 let lastline = line("$")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
204 " call Decho("lastline#".lastline)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
205 let firstdir = substitute(&rtp,',.*$','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
206 let plugins = split(globpath(firstdir,"plugin/*.vim"),'\n')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
207 let plugins = plugins + split(globpath(firstdir,"AsNeeded/*.vim"),'\n')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
208 let foundscript = 0
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
209
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
210 " this loop updates the GetLatestVimScripts.dat file
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
211 " with dependencies explicitly mentioned in the plugins
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
212 " via GetLatestVimScripts: ... lines
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
213 " It reads the plugin script at the end of the GetLatestVimScripts.dat
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
214 " file, examines it, and then removes it.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
215 for plugin in plugins
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
216 " call Decho(" ")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
217 " call Decho("plugin<".plugin.">")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
218
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
219 " read plugin in
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
220 " evidently a :r creates a new buffer (the "#" buffer) that is subsequently unused -- bwiping it
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
221 $
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
222 " call Decho(".dependency checking<".plugin."> line$=".line("$"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
223 " call Decho("..exe silent r ".fnameescape(plugin))
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
224 exe "silent r ".fnameescape(plugin)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
225 exe "silent bwipe ".bufnr("#")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
226
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
227 while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
228 let depscript = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
229 let depscriptid = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\(\d\+\)\s\+.*$','\1','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
230 let llp1 = lastline+1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
231 " call Decho("..depscript<".depscript.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
232
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
233 " found a "GetLatestVimScripts: # #" line in the script;
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
234 " check if its already in the datafile by searching backwards from llp1,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
235 " the (prior to reading in the plugin script) last line plus one of the GetLatestVimScripts.dat file,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
236 " for the script-id with no wrapping allowed.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
237 let curline = line(".")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
238 let noai_script = substitute(depscript,'\s*:AutoInstall:\s*','','e')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
239 exe llp1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
240 let srchline = search('^\s*'.depscriptid.'\s\+\d\+\s\+.*$','bW')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
241 if srchline == 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
242 " this second search is taken when, for example, a 0 0 scriptname is to be skipped over
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
243 let srchline= search('\<'.noai_script.'\>','bW')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
244 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
245 " call Decho("..noai_script<".noai_script."> depscriptid#".depscriptid." srchline#".srchline." curline#".line(".")." lastline#".lastline)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
246
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
247 if srchline == 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
248 " found a new script to permanently include in the datafile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
249 let keep_rega = @a
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
250 let @a = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
251 echomsg "Appending <".@a."> to ".datafile." for ".depscript
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
252 " call Decho("..Appending <".@a."> to ".datafile." for ".depscript)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
253 exe lastline."put a"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
254 let @a = keep_rega
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
255 let lastline = llp1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
256 let curline = curline + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
257 let foundscript = foundscript + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
258 " else " Decho
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
259 " call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
260 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
261
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
262 let curline = curline + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
263 exe curline
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
264 endwhile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
265
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
266 " llp1: last line plus one
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
267 let llp1= lastline + 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
268 " call Decho(".deleting lines: ".llp1.",$d")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
269 exe "silent! ".llp1.",$d"
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
270 endfor
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
271 " call Decho("--- end dependency checking loop --- foundscript=".foundscript)
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
272 " call Decho(" ")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
273 " call Dredir("BUFFER TEST (GetLatestVimScripts 1)","ls!")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
274
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
275 if foundscript == 0
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
276 setlocal nomod
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
277 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
278
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
279 " --------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
280 " Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
281 " --------------------------------------------------------------------
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
282 " call Decho("begin: checking out-of-date scripts using datafile<".datafile.">")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
283 setlocal lz
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
284 1
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
285 " /^-----/,$g/^\s*\d/call Decho(getline("."))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
286 1
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
287 /^-----/,$g/^\s*\d/call s:GetOneScript()
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
288 " call Decho("--- end out-of-date checking --- ")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
289
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
290 " Final report (an echomsg)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
291 try
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
292 silent! ?^-------?
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
293 catch /^Vim\%((\a\+)\)\=:E114/
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
294 " call Dret("GetLatestVimScripts : nothing done!")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
295 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
296 endtry
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
297 exe "norm! kz\<CR>"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
298 redraw!
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
299 let s:msg = ""
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
300 if s:downloads == 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
301 let s:msg = "Downloaded one updated script to <".datadir.">"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
302 elseif s:downloads == 2
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
303 let s:msg= "Downloaded two updated scripts to <".datadir.">"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
304 elseif s:downloads > 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
305 let s:msg= "Downloaded ".s:downloads." updated scripts to <".datadir.">"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
306 else
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
307 let s:msg= "Everything was already current"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
308 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
309 if s:downerrors > 0
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
310 let s:msg= s:msg." (".s:downerrors." downloading errors)"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
311 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
312 echomsg s:msg
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
313 " save the file
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
314 if &mod
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
315 silent! w!
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
316 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
317 q
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
318
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
319 " restore events and current directory
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
320 exe "cd ".fnameescape(substitute(origdir,'\','/','ge'))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
321 let &ei = eikeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
322 let &hls = hlskeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
323 let &acd = acdkeep
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
324 setlocal nolz
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
325 " call Dredir("BUFFER TEST (GetLatestVimScripts 2)","ls!")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
326 " call Dret("GetLatestVimScripts : did ".s:downloads." downloads")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
327 endfun
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
328
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
329 " ---------------------------------------------------------------------
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
330 " GetOneScript: (Get Latest Vim Script) this function operates {{{1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
331 " on the current line, interpreting two numbers and text as
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
332 " ScriptID, SourceID, and Filename.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
333 " It downloads any scripts that have newer versions from vim.sourceforge.net.
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
334 fun! s:GetOneScript(...)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
335 " call Dfunc("GetOneScript()")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
336
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
337 " set options to allow progress to be shown on screen
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
338 let rega= @a
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
339 let t_ti= &t_ti
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
340 let t_te= &t_te
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
341 let rs = &rs
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
342 set t_ti= t_te= nors
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
343
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
344 " put current line on top-of-screen and interpret it into
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
345 " a script identifer : used to obtain webpage
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
346 " source identifier : used to identify current version
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
347 " and an associated comment: used to report on what's being considered
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
348 if a:0 >= 3
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
349 let scriptid = a:1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
350 let srcid = a:2
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
351 let fname = a:3
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
352 let cmmnt = ""
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
353 " call Decho("scriptid<".scriptid.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
354 " call Decho("srcid <".srcid.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
355 " call Decho("fname <".fname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
356 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
357 let curline = getline(".")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
358 if curline =~ '^\s*#'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
359 let @a= rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
360 " call Dret("GetOneScript : skipping a pure comment line")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
361 return
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
362 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
363 let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(.\{-}\)\(\s*#.*\)\=$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
364 try
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
365 let scriptid = substitute(curline,parsepat,'\1','e')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
366 catch /^Vim\%((\a\+)\)\=:E486/
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
367 let scriptid= 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
368 endtry
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
369 try
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
370 let srcid = substitute(curline,parsepat,'\2','e')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
371 catch /^Vim\%((\a\+)\)\=:E486/
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
372 let srcid= 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
373 endtry
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
374 try
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
375 let fname= substitute(curline,parsepat,'\3','e')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
376 catch /^Vim\%((\a\+)\)\=:E486/
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
377 let fname= ""
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
378 endtry
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
379 try
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
380 let cmmnt= substitute(curline,parsepat,'\4','e')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
381 catch /^Vim\%((\a\+)\)\=:E486/
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
382 let cmmnt= ""
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
383 endtry
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
384 " call Decho("curline <".curline.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
385 " call Decho("parsepat<".parsepat.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
386 " call Decho("scriptid<".scriptid.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
387 " call Decho("srcid <".srcid.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
388 " call Decho("fname <".fname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
389 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
390
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
391 " plugin author protection from downloading his/her own scripts atop their latest work
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
392 if scriptid == 0 || srcid == 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
393 " When looking for :AutoInstall: lines, skip scripts that have 0 0 scriptname
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
394 let @a= rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
395 " call Dret("GetOneScript : skipping a scriptid==srcid==0 line")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
396 return
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
397 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
398
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
399 let doautoinstall= 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
400 if fname =~ ":AutoInstall:"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
401 " call Decho("case AutoInstall: fname<".fname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
402 let aicmmnt= substitute(fname,'\s\+:AutoInstall:\s\+',' ','')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
403 " call Decho("aicmmnt<".aicmmnt."> s:autoinstall=".s:autoinstall)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
404 if s:autoinstall != ""
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
405 let doautoinstall = g:GetLatestVimScripts_allowautoinstall
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
406 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
407 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
408 let aicmmnt= fname
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
409 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
410 " call Decho("aicmmnt<".aicmmnt.">: doautoinstall=".doautoinstall)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
411
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
412 exe "norm z\<CR>"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
413 redraw!
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
414 " call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
415 echo 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
416
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
417 " grab a copy of the plugin's vim.sourceforge.net webpage
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
418 let scriptaddr = 'http://vim.sourceforge.net/script.php?script_id='.scriptid
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
419 let tmpfile = tempname()
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
420 let v:errmsg = ""
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
421
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
422 " make up to three tries at downloading the description
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
423 let itry= 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
424 while itry <= 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
425 " call Decho(".try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
426 if has("win32") || has("win16") || has("win95")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
427 " call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)."|bw!")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
428 new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)|bw!
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
429 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
430 " call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
431 exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
432 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
433 if itry == 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
434 exe "silent vsplit ".fnameescape(tmpfile)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
435 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
436 silent! e %
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
437 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
438 setlocal bh=wipe
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
439
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
440 " find the latest source-id in the plugin's webpage
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
441 silent! 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
442 let findpkg= search('Click on the package to download','W')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
443 if findpkg > 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
444 break
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
445 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
446 let itry= itry + 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
447 endwhile
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
448 " call Decho(" --- end downloading tries while loop --- itry=".itry)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
449
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
450 " testing: did finding "Click on the package..." fail?
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
451 if findpkg == 0 || itry >= 4
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
452 silent q!
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
453 call delete(tmpfile)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
454 " restore options
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
455 let &t_ti = t_ti
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
456 let &t_te = t_te
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
457 let &rs = rs
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
458 let s:downerrors = s:downerrors + 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
459 " call Decho("***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
460 echomsg "***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
461 " call Dret("GetOneScript : srch for /Click on the package/ failed")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
462 let @a= rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
463 return
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
464 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
465 " call Decho('found "Click on the package to download"')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
466
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
467 let findsrcid= search('src_id=','W')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
468 if findsrcid == 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
469 silent q!
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
470 call delete(tmpfile)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
471 " restore options
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
472 let &t_ti = t_ti
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
473 let &t_te = t_te
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
474 let &rs = rs
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
475 let s:downerrors = s:downerrors + 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
476 " call Decho("***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
477 echomsg "***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
478 let @a= rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
479 " call Dret("GetOneScript : srch for /src_id/ failed")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
480 return
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
481 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
482 " call Decho('found "src_id=" in description page')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
483
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
484 let srcidpat = '^\s*<td class.*src_id=\(\d\+\)">\([^<]\+\)<.*$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
485 let latestsrcid= substitute(getline("."),srcidpat,'\1','')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
486 let sname = substitute(getline("."),srcidpat,'\2','') " script name actually downloaded
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
487 " call Decho("srcidpat<".srcidpat."> latestsrcid<".latestsrcid."> sname<".sname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
488 silent q!
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
489 call delete(tmpfile)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
490
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
491 " convert the strings-of-numbers into numbers
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
492 let srcid = srcid + 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
493 let latestsrcid = latestsrcid + 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
494 " call Decho("srcid=".srcid." latestsrcid=".latestsrcid." sname<".sname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
495
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
496 " has the plugin's most-recent srcid increased, which indicates that it has been updated
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
497 if latestsrcid > srcid
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
498 " call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."]: need to update <".sname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
499
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
500 let s:downloads= s:downloads + 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
501 if sname == bufname("%")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
502 " GetLatestVimScript has to be careful about downloading itself
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
503 let sname= "NEW_".sname
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
504 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
505
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
506 " -----------------------------------------------------------------------------
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
507 " the plugin has been updated since we last obtained it, so download a new copy
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
508 " -----------------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
509 " call Decho(".downloading new <".sname.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
510 echomsg ".downloading new <".sname.">"
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
511 if has("win32") || has("win16") || has("win95")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
512 " call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)."|q")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
513 new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)|q
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
514 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
515 " call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
516 exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=').latestsrcid
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
517 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
518
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
519 " --------------------------------------------------------------------------
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
520 " AutoInstall: only if doautoinstall has been requested by the plugin itself
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
521 " --------------------------------------------------------------------------
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
522 if doautoinstall
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
523 " call Decho(" ")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
524 " call Decho("Autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname))
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
525 if filereadable(sname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
526 " call Decho("<".sname."> is readable")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
527 " call Decho("exe silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
528 exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
529 let curdir = escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
530 let installdir= curdir."/Installed"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
531 if !isdirectory(installdir)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
532 call mkdir(installdir)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
533 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
534 " call Decho("curdir<".curdir."> installdir<".installdir.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
535 " call Decho("exe cd ".fnameescape(s:autoinstall))
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
536 exe "cd ".fnameescape(s:autoinstall)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
537
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
538 " determine target directory for moves
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
539 let firstdir= substitute(&rtp,',.*$','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
540 let pname = substitute(sname,'\..*','.vim','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
541 " call Decho("determine tgtdir: is <".firstdir.'/AsNeeded/'.pname." readable?")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
542 if filereadable(firstdir.'/AsNeeded/'.pname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
543 let tgtdir= "AsNeeded"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
544 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
545 let tgtdir= "plugin"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
546 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
547 " call Decho("tgtdir<".tgtdir."> pname<".pname.">")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
548
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
549 " decompress
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
550 if sname =~ '\.bz2$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
551 " call Decho("decompress: attempt to bunzip2 ".sname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
552 exe "silent !bunzip2 ".shellescape(sname)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
553 let sname= substitute(sname,'\.bz2$','','')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
554 " call Decho("decompress: new sname<".sname."> after bunzip2")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
555 elseif sname =~ '\.gz$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
556 " call Decho("decompress: attempt to gunzip ".sname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
557 exe "silent !gunzip ".shellescape(sname)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
558 let sname= substitute(sname,'\.gz$','','')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
559 " call Decho("decompress: new sname<".sname."> after gunzip")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
560 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
561 " call Decho("no decompression needed")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
562 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
563
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
564 " distribute archive(.zip, .tar, .vba) contents
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
565 if sname =~ '\.zip$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
566 " call Decho("dearchive: attempt to unzip ".sname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
567 exe "silent !unzip -o ".shellescape(sname)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
568 elseif sname =~ '\.tar$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
569 " call Decho("dearchive: attempt to untar ".sname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
570 exe "silent !tar -xvf ".shellescape(sname)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
571 elseif sname =~ '\.vba$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
572 " call Decho("dearchive: attempt to handle a vimball: ".sname)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
573 silent 1split
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
574 if exists("g:vimball_home")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
575 let oldvimballhome= g:vimball_home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
576 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
577 let g:vimball_home= s:autoinstall
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
578 exe "silent e ".fnameescape(sname)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
579 silent so %
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
580 silent q
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
581 if exists("oldvimballhome")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
582 let g:vimball_home= oldvimballhome
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
583 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
584 unlet g:vimball_home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
585 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
586 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
587 " call Decho("no dearchiving needed")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
588 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
589
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
590 " ---------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
591 " move plugin to plugin/ or AsNeeded/ directory
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
592 " ---------------------------------------------
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
593 if sname =~ '.vim$'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
594 " call Decho("dearchive: attempt to simply move ".sname." to ".tgtdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
595 exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".tgtdir
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
596 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
597 " call Decho("dearchive: move <".sname."> to installdir<".installdir.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
598 exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".installdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
599 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
600 if tgtdir != "plugin"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
601 " call Decho("exe silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
602 exe "silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
603 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
604
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
605 " helptags step
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
606 let docdir= substitute(&rtp,',.*','','e')."/doc"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
607 " call Decho("helptags: docdir<".docdir.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
608 exe "helptags ".fnameescape(docdir)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
609 exe "cd ".fnameescape(curdir)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
610 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
611 if fname !~ ':AutoInstall:'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
612 let modline=scriptid." ".latestsrcid." :AutoInstall: ".fname.cmmnt
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
613 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
614 let modline=scriptid." ".latestsrcid." ".fname.cmmnt
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
615 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
616 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
617 let modline=scriptid." ".latestsrcid." ".fname.cmmnt
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
618 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
619
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
620 " update the data in the <GetLatestVimScripts.dat> file
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
621 call setline(line("."),modline)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
622 " call Decho("update data in ".expand("%")."#".line(".").": modline<".modline.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
623 " else " Decho
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
624 " call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."], no need to update")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
625 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
626
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
627 " restore options
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
628 let &t_ti = t_ti
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
629 let &t_te = t_te
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
630 let &rs = rs
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
631 let @a = rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
632 " call Dredir("BUFFER TEST (GetOneScript)","ls!")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
633
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
634 " call Dret("GetOneScript")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
635 endfun
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
636
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
637 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
638 " Restore Options: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
639 let &cpo= s:keepcpo
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
640 unlet s:keepcpo
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
641
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
642 " ---------------------------------------------------------------------
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
643 " Modelines: {{{1
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
644 " vim: ts=8 sts=2 fdm=marker nowrap