annotate runtime/autoload/getscript.vim @ 9624:d63b85fe3dc7 v7.4.2089

commit https://github.com/vim/vim/commit/36edf0685c8b55ee3ce709058d83ada8027fec1e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 21 22:10:12 2016 +0200 patch 7.4.2089 Problem: Color handling of X11 GUIs is too complicated. Solution: Simplify the code. Use RGBA where appropriate. (Kazunobu Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Thu, 21 Jul 2016 22:15:05 +0200
parents 350272cbf1fd
children 8a1481e59d64
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
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
3 " Author: Charles E. Campbell
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
4 " Date: Jan 21, 2014
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
5 " Version: 36
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
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
18 let g:loaded_getscript= "v36"
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
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
77 " set up default scriptaddr address
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
78 if !exists("g:GetLatestVimScripts_scriptaddr")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
79 let g:GetLatestVimScripts_scriptaddr = 'http://vim.sourceforge.net/script.php?script_id='
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
80 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
81
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
82 "" For debugging:
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
83 "let g:GetLatestVimScripts_wget = "echo"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
84 "let g:GetLatestVimScripts_options = "options"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
85
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
86 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
87 " Check If AutoInstall Capable: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
88 let s:autoinstall= ""
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
89 if g:GetLatestVimScripts_allowautoinstall
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
90
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
91 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
92 " windows (but not cygwin/bash)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
93 let s:dotvim= "vimfiles"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
94 if !exists("g:GetLatestVimScripts_mv")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
95 let g:GetLatestVimScripts_mv= "ren"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
96 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
97
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
98 else
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
99 " unix
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
100 let s:dotvim= ".vim"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
101 if !exists("g:GetLatestVimScripts_mv")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
102 let g:GetLatestVimScripts_mv= "mv"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
103 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
104 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
105
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
106 if exists("g:GetLatestVimScripts_autoinstalldir") && isdirectory(g:GetLatestVimScripts_autoinstalldir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
107 let s:autoinstall= g:GetLatestVimScripts_autoinstalldir"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
108 elseif exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
109 let s:autoinstall= $HOME."/".s:dotvim
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
110 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
111 " call Decho("s:autoinstall<".s:autoinstall.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
112 "else "Decho
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
113 " call Decho("g:GetLatestVimScripts_allowautoinstall=".g:GetLatestVimScripts_allowautoinstall.": :AutoInstall: disabled")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
114 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
115
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
116 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
117 " Public Interface: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
118 com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts()
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
119 com! -nargs=0 GetScript call getscript#GetLatestVimScripts()
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
120 silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts()
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
122 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
123 " GetLatestVimScripts: this function gets the latest versions of {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
124 " scripts based on the list in
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
125 " (first dir in runtimepath)/GetLatest/GetLatestVimScripts.dat
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
126 fun! getscript#GetLatestVimScripts()
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
127 " call Dfunc("GetLatestVimScripts() autoinstall<".s:autoinstall.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
128
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
129 " insure that wget is executable
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
130 if executable(g:GetLatestVimScripts_wget) != 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
131 echoerr "GetLatestVimScripts needs ".g:GetLatestVimScripts_wget." which apparently is not available on your system"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
132 " call Dret("GetLatestVimScripts : wget not executable/availble")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
133 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
134 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
135
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
136 " insure that fnameescape() is available
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
137 if !exists("*fnameescape")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
138 echoerr "GetLatestVimScripts needs fnameescape() (provided by 7.1.299 or later)"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
139 return
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
140 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1620
diff changeset
141
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
142 " Find the .../GetLatest subdirectory under the runtimepath
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
143 for datadir in split(&rtp,',') + ['']
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
144 if isdirectory(datadir."/GetLatest")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
145 " call Decho("found directory<".datadir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
146 let datadir= datadir . "/GetLatest"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
147 break
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
148 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
149 if filereadable(datadir."GetLatestVimScripts.dat")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
150 " call Decho("found ".datadir."/GetLatestVimScripts.dat")
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
151 break
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
152 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
153 endfor
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
154
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
155 " Sanity checks: readability and writability
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
156 if datadir == ""
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
157 echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install'
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
158 " call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory")
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 if filewritable(datadir) != 2
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
162 echoerr "(getLatestVimScripts) Your ".datadir." isn't writable"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
163 " call Dret("GetLatestVimScripts : non-writable directory<".datadir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
164 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
165 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
166 let datafile= datadir."/GetLatestVimScripts.dat"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
167 if !filereadable(datafile)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
168 echoerr "Your data file<".datafile."> isn't readable"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
169 " call Dret("GetLatestVimScripts : non-readable 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
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
172 if !filewritable(datafile)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
173 echoerr "Your data file<".datafile."> isn't writable"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
174 " call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
175 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
176 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
177 " --------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
178 " Passed sanity checks
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
179 " --------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
180
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
181 " call Decho("datadir <".datadir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
182 " call Decho("datafile <".datafile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
183
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
184 " 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
185 let eikeep = &ei
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
186 let hlskeep = &hls
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
187 let acdkeep = &acd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
188 set ei=all hls&vim noacd
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
189
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
190 " Edit the datafile (ie. GetLatestVimScripts.dat):
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
191 " 1. record current directory (origdir),
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
192 " 2. change directory to datadir,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
193 " 3. split window
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
194 " 4. edit datafile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
195 let origdir= getcwd()
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
196 " call Decho("exe cd ".fnameescape(substitute(datadir,'\','/','ge')))
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
197 exe "cd ".fnameescape(substitute(datadir,'\','/','ge'))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
198 split
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
199 " call Decho("exe e ".fnameescape(substitute(datafile,'\','/','ge')))
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
200 exe "e ".fnameescape(substitute(datafile,'\','/','ge'))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
201 res 1000
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
202 let s:downloads = 0
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
203 let s:downerrors= 0
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
204
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
205 " Check on dependencies mentioned in plugins
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
206 " call Decho(" ")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
207 " call Decho("searching plugins for GetLatestVimScripts dependencies")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
208 let lastline = line("$")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
209 " call Decho("lastline#".lastline)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
210 let firstdir = substitute(&rtp,',.*$','','')
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
211 let plugins = split(globpath(firstdir,"plugin/**/*.vim"),'\n')
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
212 let plugins = plugins + split(globpath(firstdir,"AsNeeded/**/*.vim"),'\n')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
213 let foundscript = 0
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
214
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
215 " this loop updates the GetLatestVimScripts.dat file
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
216 " with dependencies explicitly mentioned in the plugins
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
217 " via GetLatestVimScripts: ... lines
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
218 " 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
219 " file, examines it, and then removes it.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
220 for plugin in plugins
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
221 " call Decho(" ")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
222 " call Decho("plugin<".plugin.">")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
223
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
224 " read plugin in
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
225 " 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
226 $
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
227 " call Decho(".dependency checking<".plugin."> line$=".line("$"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
228 " call Decho("..exe silent r ".fnameescape(plugin))
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
229 exe "silent r ".fnameescape(plugin)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
230 exe "silent bwipe ".bufnr("#")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
231
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
232 while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
233 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
234 let depscriptid = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\(\d\+\)\s\+.*$','\1','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
235 let llp1 = lastline+1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
236 " call Decho("..depscript<".depscript.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
237
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
238 " found a "GetLatestVimScripts: # #" line in the script;
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
239 " 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
240 " 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
241 " for the script-id with no wrapping allowed.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
242 let curline = line(".")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
243 let noai_script = substitute(depscript,'\s*:AutoInstall:\s*','','e')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
244 exe llp1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
245 let srchline = search('^\s*'.depscriptid.'\s\+\d\+\s\+.*$','bW')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
246 if srchline == 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
247 " 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
248 let srchline= search('\<'.noai_script.'\>','bW')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
249 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
250 " 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
251
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
252 if srchline == 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
253 " found a new script to permanently include in the datafile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
254 let keep_rega = @a
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
255 let @a = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
256 echomsg "Appending <".@a."> to ".datafile." for ".depscript
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
257 " call Decho("..Appending <".@a."> to ".datafile." for ".depscript)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
258 exe lastline."put a"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
259 let @a = keep_rega
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
260 let lastline = llp1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
261 let curline = curline + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
262 let foundscript = foundscript + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
263 " else " Decho
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
264 " call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")")
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
265 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
266
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
267 let curline = curline + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
268 exe curline
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
269 endwhile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
270
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
271 " llp1: last line plus one
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
272 let llp1= lastline + 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
273 " call Decho(".deleting lines: ".llp1.",$d")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
274 exe "silent! ".llp1.",$d"
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
275 endfor
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
276 " call Decho("--- end dependency checking loop --- foundscript=".foundscript)
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
277 " call Decho(" ")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
278 " call Dredir("BUFFER TEST (GetLatestVimScripts 1)","ls!")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
279
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
280 if foundscript == 0
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
281 setlocal nomod
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
282 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
283
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
284 " --------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
285 " Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
286 " --------------------------------------------------------------------
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
287 " call Decho("begin: checking out-of-date scripts using datafile<".datafile.">")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
288 setlocal lz
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
289 1
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
290 " /^-----/,$g/^\s*\d/call Decho(getline("."))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
291 1
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
292 /^-----/,$g/^\s*\d/call s:GetOneScript()
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
293 " call Decho("--- end out-of-date checking --- ")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
294
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
295 " Final report (an echomsg)
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
296 try
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
297 silent! ?^-------?
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
298 catch /^Vim\%((\a\+)\)\=:E114/
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
299 " call Dret("GetLatestVimScripts : nothing done!")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
300 return
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
301 endtry
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
302 exe "norm! kz\<CR>"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
303 redraw!
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
304 let s:msg = ""
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
305 if s:downloads == 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
306 let s:msg = "Downloaded one updated script to <".datadir.">"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
307 elseif s:downloads == 2
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
308 let s:msg= "Downloaded two updated scripts to <".datadir.">"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
309 elseif s:downloads > 1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
310 let s:msg= "Downloaded ".s:downloads." updated scripts to <".datadir.">"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
311 else
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
312 let s:msg= "Everything was already current"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
313 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
314 if s:downerrors > 0
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
315 let s:msg= s:msg." (".s:downerrors." downloading errors)"
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
316 endif
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
317 echomsg s:msg
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
318 " save the file
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
319 if &mod
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
320 silent! w!
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
321 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
322 q!
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
323
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
324 " restore events and current directory
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
325 exe "cd ".fnameescape(substitute(origdir,'\','/','ge'))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
326 let &ei = eikeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
327 let &hls = hlskeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
328 let &acd = acdkeep
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
329 setlocal nolz
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
330 " call Dredir("BUFFER TEST (GetLatestVimScripts 2)","ls!")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
331 " call Dret("GetLatestVimScripts : did ".s:downloads." downloads")
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
332 endfun
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
333
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
334 " ---------------------------------------------------------------------
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
335 " GetOneScript: (Get Latest Vim Script) this function operates {{{1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
336 " on the current line, interpreting two numbers and text as
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
337 " ScriptID, SourceID, and Filename.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
338 " It downloads any scripts that have newer versions from vim.sourceforge.net.
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
339 fun! s:GetOneScript(...)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
340 " call Dfunc("GetOneScript()")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
341
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
342 " set options to allow progress to be shown on screen
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
343 let rega= @a
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
344 let t_ti= &t_ti
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
345 let t_te= &t_te
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
346 let rs = &rs
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
347 set t_ti= t_te= nors
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
348
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
349 " put current line on top-of-screen and interpret it into
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
350 " a script identifer : used to obtain webpage
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
351 " source identifier : used to identify current version
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
352 " and an associated comment: used to report on what's being considered
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
353 if a:0 >= 3
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
354 let scriptid = a:1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
355 let srcid = a:2
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
356 let fname = a:3
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
357 let cmmnt = ""
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
358 " call Decho("scriptid<".scriptid.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
359 " call Decho("srcid <".srcid.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
360 " call Decho("fname <".fname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
361 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
362 let curline = getline(".")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
363 if curline =~ '^\s*#'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
364 let @a= rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
365 " call Dret("GetOneScript : skipping a pure comment line")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
366 return
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
367 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
368 let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(.\{-}\)\(\s*#.*\)\=$'
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 scriptid = substitute(curline,parsepat,'\1','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 scriptid= 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 srcid = substitute(curline,parsepat,'\2','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 srcid= 0
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 fname= substitute(curline,parsepat,'\3','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 fname= ""
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 try
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
385 let cmmnt= substitute(curline,parsepat,'\4','e')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
386 catch /^Vim\%((\a\+)\)\=:E486/
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
387 let cmmnt= ""
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
388 endtry
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
389 " call Decho("curline <".curline.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
390 " call Decho("parsepat<".parsepat.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
391 " call Decho("scriptid<".scriptid.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
392 " call Decho("srcid <".srcid.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
393 " call Decho("fname <".fname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
394 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
395
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
396 " 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
397 if scriptid == 0 || srcid == 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
398 " When looking for :AutoInstall: lines, skip scripts that have 0 0 scriptname
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
399 let @a= rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
400 " call Dret("GetOneScript : skipping a scriptid==srcid==0 line")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
401 return
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
402 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
403
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
404 let doautoinstall= 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
405 if fname =~ ":AutoInstall:"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
406 " call Decho("case AutoInstall: fname<".fname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
407 let aicmmnt= substitute(fname,'\s\+:AutoInstall:\s\+',' ','')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
408 " call Decho("aicmmnt<".aicmmnt."> s:autoinstall=".s:autoinstall)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
409 if s:autoinstall != ""
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
410 let doautoinstall = g:GetLatestVimScripts_allowautoinstall
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
411 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
412 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
413 let aicmmnt= fname
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
414 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
415 " call Decho("aicmmnt<".aicmmnt.">: doautoinstall=".doautoinstall)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
416
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
417 exe "norm z\<CR>"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
418 redraw!
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
419 " call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
420 echo 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
421
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
422 " grab a copy of the plugin's vim.sourceforge.net webpage
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
423 let scriptaddr = g:GetLatestVimScripts_scriptaddr.scriptid
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
424 let tmpfile = tempname()
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
425 let v:errmsg = ""
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
426
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
427 " make up to three tries at downloading the description
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
428 let itry= 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
429 while itry <= 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
430 " call Decho(".try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
431 if has("win32") || has("win16") || has("win95")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
432 " 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
433 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
434 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
435 " 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
436 exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr)
1620
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 if itry == 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
439 exe "silent vsplit ".fnameescape(tmpfile)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
440 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
441 silent! e %
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
442 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
443 setlocal bh=wipe
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
444
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
445 " find the latest source-id in the plugin's webpage
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
446 silent! 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
447 let findpkg= search('Click on the package to download','W')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
448 if findpkg > 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
449 break
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
450 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
451 let itry= itry + 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
452 endwhile
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
453 " call Decho(" --- end downloading tries while loop --- itry=".itry)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
454
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
455 " testing: did finding "Click on the package..." fail?
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
456 if findpkg == 0 || itry >= 4
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
457 silent q!
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
458 call delete(tmpfile)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
459 " restore options
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
460 let &t_ti = t_ti
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
461 let &t_te = t_te
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
462 let &rs = rs
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
463 let s:downerrors = s:downerrors + 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
464 " 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
465 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
466 " call Dret("GetOneScript : srch for /Click on the package/ failed")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
467 let @a= rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
468 return
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
469 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
470 " call Decho('found "Click on the package to download"')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
471
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
472 let findsrcid= search('src_id=','W')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
473 if findsrcid == 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
474 silent q!
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
475 call delete(tmpfile)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
476 " restore options
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
477 let &t_ti = t_ti
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
478 let &t_te = t_te
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
479 let &rs = rs
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
480 let s:downerrors = s:downerrors + 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
481 " call Decho("***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
482 echomsg "***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
483 let @a= rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
484 " call Dret("GetOneScript : srch for /src_id/ failed")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
485 return
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
486 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
487 " call Decho('found "src_id=" in description page')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
488
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
489 let srcidpat = '^\s*<td class.*src_id=\(\d\+\)">\([^<]\+\)<.*$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
490 let latestsrcid= substitute(getline("."),srcidpat,'\1','')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
491 let sname = substitute(getline("."),srcidpat,'\2','') " script name actually downloaded
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
492 " call Decho("srcidpat<".srcidpat."> latestsrcid<".latestsrcid."> sname<".sname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
493 silent q!
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
494 call delete(tmpfile)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
495
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
496 " convert the strings-of-numbers into numbers
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
497 let srcid = srcid + 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
498 let latestsrcid = latestsrcid + 0
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
499 " call Decho("srcid=".srcid." latestsrcid=".latestsrcid." sname<".sname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
500
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
501 " 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
502 if latestsrcid > srcid
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
503 " call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."]: need to update <".sname.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
504
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
505 let s:downloads= s:downloads + 1
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
506 if sname == bufname("%")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
507 " GetLatestVimScript has to be careful about downloading itself
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
508 let sname= "NEW_".sname
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
509 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
510
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
511 " -----------------------------------------------------------------------------
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
512 " 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
513 " -----------------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
514 " call Decho(".downloading new <".sname.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
515 echomsg ".downloading new <".sname.">"
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
516 if has("win32") || has("win16") || has("win95")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
517 " 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
518 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
519 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
520 " 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
521 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
522 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
523
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
524 " --------------------------------------------------------------------------
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
525 " 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
526 " --------------------------------------------------------------------------
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
527 " call Decho("checking if plugin requested autoinstall: doautoinstall=".doautoinstall)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
528 if doautoinstall
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
529 " call Decho(" ")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
530 " call Decho("Autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname))
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
531 if filereadable(sname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
532 " call Decho("<".sname."> is readable")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
533 " 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
534 exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
535 let curdir = fnameescape(substitute(getcwd(),'\','/','ge'))
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
536 let installdir= curdir."/Installed"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
537 if !isdirectory(installdir)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
538 call mkdir(installdir)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
539 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
540 " call Decho("curdir<".curdir."> installdir<".installdir.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
541 " call Decho("exe cd ".fnameescape(s:autoinstall))
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
542 exe "cd ".fnameescape(s:autoinstall)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
543
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
544 " determine target directory for moves
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
545 let firstdir= substitute(&rtp,',.*$','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
546 let pname = substitute(sname,'\..*','.vim','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
547 " call Decho("determine tgtdir: is <".firstdir.'/AsNeeded/'.pname." readable?")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
548 if filereadable(firstdir.'/AsNeeded/'.pname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
549 let tgtdir= "AsNeeded"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
550 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
551 let tgtdir= "plugin"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
552 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
553 " call Decho("tgtdir<".tgtdir."> pname<".pname.">")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
554
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
555 " decompress
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
556 if sname =~ '\.bz2$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
557 " call Decho("decompress: attempt to bunzip2 ".sname)
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
558 exe "sil !bunzip2 ".shellescape(sname)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
559 let sname= substitute(sname,'\.bz2$','','')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
560 " call Decho("decompress: new sname<".sname."> after bunzip2")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
561 elseif sname =~ '\.gz$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
562 " call Decho("decompress: attempt to gunzip ".sname)
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
563 exe "sil !gunzip ".shellescape(sname)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
564 let sname= substitute(sname,'\.gz$','','')
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
565 " call Decho("decompress: new sname<".sname."> after gunzip")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
566 elseif sname =~ '\.xz$'
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
567 " call Decho("decompress: attempt to unxz ".sname)
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
568 exe "sil !unxz ".shellescape(sname)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
569 let sname= substitute(sname,'\.xz$','','')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
570 " call Decho("decompress: new sname<".sname."> after unxz")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
571 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
572 " call Decho("no decompression needed")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
573 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
574
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
575 " distribute archive(.zip, .tar, .vba, ...) contents
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
576 if sname =~ '\.zip$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
577 " call Decho("dearchive: attempt to unzip ".sname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
578 exe "silent !unzip -o ".shellescape(sname)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
579 elseif sname =~ '\.tar$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
580 " call Decho("dearchive: attempt to untar ".sname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
581 exe "silent !tar -xvf ".shellescape(sname)
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
582 elseif sname =~ '\.tgz$'
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
583 " call Decho("dearchive: attempt to untar+gunzip ".sname)
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
584 exe "silent !tar -zxvf ".shellescape(sname)
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
585 elseif sname =~ '\.taz$'
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
586 " call Decho("dearchive: attempt to untar+uncompress ".sname)
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
587 exe "silent !tar -Zxvf ".shellescape(sname)
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
588 elseif sname =~ '\.tbz$'
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
589 " call Decho("dearchive: attempt to untar+bunzip2 ".sname)
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
590 exe "silent !tar -jxvf ".shellescape(sname)
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
591 elseif sname =~ '\.txz$'
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
592 " call Decho("dearchive: attempt to untar+xz ".sname)
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
593 exe "silent !tar -Jxvf ".shellescape(sname)
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
594 elseif sname =~ '\.vba$'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
595 " call Decho("dearchive: attempt to handle a vimball: ".sname)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
596 silent 1split
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
597 if exists("g:vimball_home")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
598 let oldvimballhome= g:vimball_home
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 let g:vimball_home= s:autoinstall
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
601 exe "silent e ".fnameescape(sname)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
602 silent so %
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
603 silent q
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
604 if exists("oldvimballhome")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
605 let g:vimball_home= oldvimballhome
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
606 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
607 unlet g:vimball_home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
608 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
609 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
610 " call Decho("no dearchiving needed")
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
611 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
612
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
613 " ---------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
614 " move plugin to plugin/ or AsNeeded/ directory
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
615 " ---------------------------------------------
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
616 if sname =~ '.vim$'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
617 " call Decho("dearchive: attempt to simply move ".sname." to ".tgtdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
618 exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".tgtdir
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
619 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
620 " call Decho("dearchive: move <".sname."> to installdir<".installdir.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
621 exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".installdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
622 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
623 if tgtdir != "plugin"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
624 " call Decho("exe silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1668
diff changeset
625 exe "silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
626 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
627
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
628 " helptags step
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
629 let docdir= substitute(&rtp,',.*','','e')."/doc"
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
630 " call Decho("helptags: docdir<".docdir.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
631 exe "helptags ".fnameescape(docdir)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
632 exe "cd ".fnameescape(curdir)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
633 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
634 if fname !~ ':AutoInstall:'
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
635 let modline=scriptid." ".latestsrcid." :AutoInstall: ".fname.cmmnt
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
636 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
637 let modline=scriptid." ".latestsrcid." ".fname.cmmnt
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
638 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
639 else
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
640 let modline=scriptid." ".latestsrcid." ".fname.cmmnt
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
641 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
642
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
643 " update the data in the <GetLatestVimScripts.dat> file
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
644 call setline(line("."),modline)
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
645 " call Decho("update data in ".expand("%")."#".line(".").": modline<".modline.">")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
646 " else " Decho
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
647 " call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."], no need to update")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
648 endif
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
649
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
650 " restore options
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
651 let &t_ti = t_ti
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
652 let &t_te = t_te
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
653 let &rs = rs
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
654 let @a = rega
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
655 " call Dredir("BUFFER TEST (GetOneScript)","ls!")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
656
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
657 " call Dret("GetOneScript")
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
658 endfun
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
659
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
660 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
661 " Restore Options: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
662 let &cpo= s:keepcpo
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
663 unlet s:keepcpo
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
664
1620
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
665 " ---------------------------------------------------------------------
73fe8baea242 updated for version 7.2a
vimboss
parents: 1240
diff changeset
666 " Modelines: {{{1
1121
e63691e7c504 updated for version 7.1a
vimboss
parents:
diff changeset
667 " vim: ts=8 sts=2 fdm=marker nowrap