annotate runtime/autoload/vimball.vim @ 17503:638669fc0f65

Added tag v8.1.1749 for changeset bc6088919610f568ed7e9e776e3cb2e13869a13b
author Bram Moolenaar <Bram@vim.org>
date Thu, 25 Jul 2019 22:00:06 +0200
parents 8a1481e59d64
children 02bd0fe77c68
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
1 " vimball.vim : construct a file containing both paths and files
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
2 " Author: Charles E. Campbell
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
3 " Date: Apr 11, 2016
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
4 " Version: 37
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
5 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
6 " Copyright: (c) 2004-2011 by Charles E. Campbell
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
7 " The VIM LICENSE applies to Vimball.vim, and Vimball.txt
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
8 " (see |copyright|) except use "Vimball" instead of "Vim".
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
9 " No warranty, express or implied.
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
10 " *** *** Use At-Your-Own-Risk! *** ***
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
11
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
12 " ---------------------------------------------------------------------
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
13 " Load Once: {{{1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
14 if &cp || exists("g:loaded_vimball")
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
15 finish
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
16 endif
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
17 let g:loaded_vimball = "v37"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
18 if v:version < 702
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
19 echohl WarningMsg
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
20 echo "***warning*** this version of vimball needs vim 7.2"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
21 echohl Normal
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
22 finish
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
23 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
24 let s:keepcpo= &cpo
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
25 set cpo&vim
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
26 "DechoTabOn
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
27
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
28 " =====================================================================
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
29 " Constants: {{{1
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
30 if !exists("s:USAGE")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
31 let s:USAGE = 0
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
32 let s:WARNING = 1
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
33 let s:ERROR = 2
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
34
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
35 " determine if cygwin is in use or not
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
36 if !exists("g:netrw_cygwin")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
37 if has("win32") || has("win95") || has("win64") || has("win16")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
38 if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
39 let g:netrw_cygwin= 1
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
40 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
41 let g:netrw_cygwin= 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
42 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
43 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
44 let g:netrw_cygwin= 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
45 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
46 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
47
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
48 " set up g:vimball_mkdir if the mkdir() call isn't defined
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
49 if !exists("*mkdir")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
50 if exists("g:netrw_local_mkdir")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
51 let g:vimball_mkdir= g:netrw_local_mkdir
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
52 elseif executable("mkdir")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
53 let g:vimball_mkdir= "mkdir"
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
54 elseif executable("makedir")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
55 let g:vimball_mkdir= "makedir"
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
56 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
57 if !exists(g:vimball_mkdir)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
58 call vimball#ShowMesg(s:WARNING,"(vimball) g:vimball_mkdir undefined")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
59 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
60 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
61 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
62
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
63 " =====================================================================
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
64 " Functions: {{{1
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
65
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
66 " ---------------------------------------------------------------------
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
67 " vimball#MkVimball: creates a vimball given a list of paths to files {{{2
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
68 " Input:
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
69 " line1,line2: a range of lines containing paths to files to be included in the vimball
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
70 " writelevel : if true, force a write to filename.vmb, even if it exists
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
71 " (usually accomplished with :MkVimball! ...
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
72 " filename : base name of file to be created (ie. filename.vmb)
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
73 " Output: a filename.vmb using vimball format:
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
74 " path
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
75 " filesize
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
76 " [file]
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
77 " path
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
78 " filesize
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
79 " [file]
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
80 fun! vimball#MkVimball(line1,line2,writelevel,...) range
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
81 " call Dfunc("MkVimball(line1=".a:line1." line2=".a:line2." writelevel=".a:writelevel." vimballname<".a:1.">) a:0=".a:0)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
82 if a:1 =~ '\.vim$' || a:1 =~ '\.txt$'
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
83 let vbname= substitute(a:1,'\.\a\{3}$','.vmb','')
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
84 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
85 let vbname= a:1
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
86 endif
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
87 if vbname !~ '\.vmb$'
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
88 let vbname= vbname.'.vmb'
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
89 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
90 " call Decho("vbname<".vbname.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
91 if !a:writelevel && a:1 =~ '[\/]'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
92 call vimball#ShowMesg(s:ERROR,"(MkVimball) vimball name<".a:1."> should not include slashes; use ! to insist")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
93 " call Dret("MkVimball : vimball name<".a:1."> should not include slashes")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
94 return
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
95 endif
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
96 if !a:writelevel && filereadable(vbname)
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
97 call vimball#ShowMesg(s:ERROR,"(MkVimball) file<".vbname."> exists; use ! to insist")
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
98 " call Dret("MkVimball : file<".vbname."> already exists; use ! to insist")
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
99 return
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
100 endif
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
101
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
102 " user option bypass
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
103 call vimball#SaveSettings()
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
104
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
105 if a:0 >= 2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
106 " allow user to specify where to get the files
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
107 let home= expand(a:2)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
108 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
109 " use first existing directory from rtp
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
110 let home= vimball#VimballHome()
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
111 endif
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
112
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
113 " save current directory
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
114 let curdir = getcwd()
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
115 call s:ChgDir(home)
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
116
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
117 " record current tab, initialize while loop index
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
118 let curtabnr = tabpagenr()
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
119 let linenr = a:line1
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
120 " call Decho("curtabnr=".curtabnr)
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
121
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
122 while linenr <= a:line2
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
123 let svfile = getline(linenr)
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
124 " call Decho("svfile<".svfile.">")
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
125
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
126 if !filereadable(svfile)
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
127 call vimball#ShowMesg(s:ERROR,"unable to read file<".svfile.">")
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
128 call s:ChgDir(curdir)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
129 call vimball#RestoreSettings()
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
130 " call Dret("MkVimball")
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
131 return
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
132 endif
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
133
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
134 " create/switch to mkvimball tab
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
135 if !exists("vbtabnr")
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
136 tabnew
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
137 sil! file Vimball
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
138 let vbtabnr= tabpagenr()
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
139 else
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
140 exe "tabn ".vbtabnr
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
141 endif
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
142
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
143 let lastline= line("$") + 1
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
144 if lastline == 2 && getline("$") == ""
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
145 call setline(1,'" Vimball Archiver by Charles E. Campbell')
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
146 call setline(2,'UseVimball')
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
147 call setline(3,'finish')
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
148 let lastline= line("$") + 1
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
149 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
150 call setline(lastline ,substitute(svfile,'$',' [[[1',''))
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
151 call setline(lastline+1,0)
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
152
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
153 " write the file from the tab
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
154 " call Decho("exe $r ".fnameescape(svfile))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
155 exe "$r ".fnameescape(svfile)
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
156
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
157 call setline(lastline+1,line("$") - lastline - 1)
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
158 " call Decho("lastline=".lastline." line$=".line("$"))
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
159
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
160 " restore to normal tab
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
161 exe "tabn ".curtabnr
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
162 let linenr= linenr + 1
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
163 endwhile
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
164
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
165 " write the vimball
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
166 exe "tabn ".vbtabnr
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
167 call s:ChgDir(curdir)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
168 setlocal ff=unix
796
cc3902a09300 updated for version 7.0232
vimboss
parents: 792
diff changeset
169 if a:writelevel
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
170 " call Decho("exe w! ".fnameescape(vbname))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
171 exe "w! ".fnameescape(vbname)
796
cc3902a09300 updated for version 7.0232
vimboss
parents: 792
diff changeset
172 else
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
173 " call Decho("exe w ".fnameescape(vbname))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
174 exe "w ".fnameescape(vbname)
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
175 endif
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
176 " call Decho("Vimball<".vbname."> created")
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
177 echo "Vimball<".vbname."> created"
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
178
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
179 " remove the evidence
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
180 setlocal nomod bh=wipe
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
181 exe "tabn ".curtabnr
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
182 exe "tabc! ".vbtabnr
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
183
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
184 " restore options
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
185 call vimball#RestoreSettings()
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
186
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
187 " call Dret("MkVimball")
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
188 endfun
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
189
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
190 " ---------------------------------------------------------------------
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
191 " vimball#Vimball: extract and distribute contents from a vimball {{{2
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
192 " (invoked the the UseVimball command embedded in
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
193 " vimballs' prologue)
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
194 fun! vimball#Vimball(really,...)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
195 " call Dfunc("vimball#Vimball(really=".a:really.") a:0=".a:0)
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
196
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
197 if v:version < 701 || (v:version == 701 && !exists('*fnameescape'))
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
198 echoerr "your vim is missing the fnameescape() function (pls upgrade to vim 7.2 or later)"
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
199 " call Dret("vimball#Vimball : needs 7.1 with patch 299 or later")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
200 return
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
201 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
202
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
203 if getline(1) !~ '^" Vimball Archiver'
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
204 echoerr "(Vimball) The current file does not appear to be a Vimball!"
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
205 " call Dret("vimball#Vimball")
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
206 return
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
207 endif
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
208
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
209 " set up standard settings
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
210 call vimball#SaveSettings()
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
211 let curtabnr = tabpagenr()
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
212 let vimballfile = expand("%:tr")
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
213
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
214 " set up vimball tab
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
215 " call Decho("setting up vimball tab")
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
216 tabnew
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
217 sil! file Vimball
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
218 let vbtabnr= tabpagenr()
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
219 let didhelp= ""
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
220
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
221 " go to vim plugin home
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
222 if a:0 > 0
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
223 " let user specify the directory where the vimball is to be unpacked.
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
224 " If, however, the user did not specify a full path, set the home to be below the current directory
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
225 let home= expand(a:1)
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
226 if has("win32") || has("win95") || has("win64") || has("win16")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
227 if home !~ '^\a:[/\\]'
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
228 let home= getcwd().'/'.a:1
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
229 endif
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
230 elseif home !~ '^/'
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
231 let home= getcwd().'/'.a:1
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
232 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
233 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
234 let home= vimball#VimballHome()
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
235 endif
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
236 " call Decho("home<".home.">")
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
237
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
238 " save current directory and remove older same-named vimball, if any
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
239 let curdir = getcwd()
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
240 " call Decho("home<".home.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
241 " call Decho("curdir<".curdir.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
242
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
243 call s:ChgDir(home)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
244 let s:ok_unablefind= 1
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
245 call vimball#RmVimball(vimballfile)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
246 unlet s:ok_unablefind
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
247
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
248 let linenr = 4
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
249 let filecnt = 0
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
250
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
251 " give title to listing of (extracted) files from Vimball Archive
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
252 if a:really
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
253 echohl Title | echomsg "Vimball Archive" | echohl None
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
254 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
255 echohl Title | echomsg "Vimball Archive Listing" | echohl None
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
256 echohl Statement | echomsg "files would be placed under: ".home | echohl None
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
257 endif
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
258
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
259 " apportion vimball contents to various files
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
260 " call Decho("exe tabn ".curtabnr)
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
261 exe "tabn ".curtabnr
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
262 " call Decho("linenr=".linenr." line$=".line("$"))
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
263 while 1 < linenr && linenr < line("$")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
264 let fname = substitute(getline(linenr),'\t\[\[\[1$','','')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
265 let fname = substitute(fname,'\\','/','g')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
266 let fsize = substitute(getline(linenr+1),'^\(\d\+\).\{-}$','\1','')+0
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
267 let fenc = substitute(getline(linenr+1),'^\d\+\s*\(\S\{-}\)$','\1','')
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
268 let filecnt = filecnt + 1
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
269 " call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt. " fenc=".fenc)
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
270
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
271 if a:really
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
272 echomsg "extracted <".fname.">: ".fsize." lines"
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
273 else
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
274 echomsg "would extract <".fname.">: ".fsize." lines"
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
275 endif
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
276 " call Decho("using L#".linenr.": will extract file<".fname.">")
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
277 " call Decho("using L#".(linenr+1).": fsize=".fsize)
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
278
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
279 " Allow AsNeeded/ directory to take place of plugin/ directory
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
280 " when AsNeeded/filename is filereadable or was present in VimballRecord
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
281 if fname =~ '\<plugin/'
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
282 let anfname= substitute(fname,'\<plugin/','AsNeeded/','')
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
283 if filereadable(anfname) || (exists("s:VBRstring") && s:VBRstring =~# anfname)
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
284 " call Decho("using anfname<".anfname."> instead of <".fname.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
285 let fname= anfname
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
286 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
287 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
288
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
289 " make directories if they don't exist yet
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
290 if a:really
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
291 " call Decho("making directories if they don't exist yet (fname<".fname.">)")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
292 let fnamebuf= substitute(fname,'\\','/','g')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
293 let dirpath = substitute(home,'\\','/','g')
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
294 " call Decho("init: fnamebuf<".fnamebuf.">")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
295 " call Decho("init: dirpath <".dirpath.">")
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
296 while fnamebuf =~ '/'
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
297 let dirname = dirpath."/".substitute(fnamebuf,'/.*$','','')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
298 let dirpath = dirname
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
299 let fnamebuf = substitute(fnamebuf,'^.\{-}/\(.*\)$','\1','')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
300 " call Decho("dirname<".dirname.">")
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
301 " call Decho("dirpath<".dirpath.">")
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
302 if !isdirectory(dirname)
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
303 " call Decho("making <".dirname.">")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
304 if exists("g:vimball_mkdir")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
305 call system(g:vimball_mkdir." ".shellescape(dirname))
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
306 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
307 call mkdir(dirname)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
308 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
309 call s:RecordInVar(home,"rmdir('".dirname."')")
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
310 endif
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
311 endwhile
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
312 endif
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
313 call s:ChgDir(home)
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
314
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
315 " grab specified qty of lines and place into "a" buffer
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
316 " (skip over path/filename and qty-lines)
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
317 let linenr = linenr + 2
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
318 let lastline = linenr + fsize - 1
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
319 " call Decho("exe ".linenr.",".lastline."yank a")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
320 " no point in handling a zero-length file
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
321 if lastline >= linenr
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
322 exe "silent ".linenr.",".lastline."yank a"
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
323
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
324 " copy "a" buffer into tab
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
325 " call Decho('copy "a buffer into tab#'.vbtabnr)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
326 exe "tabn ".vbtabnr
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
327 setlocal ma
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
328 sil! %d
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
329 silent put a
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
330 1
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
331 sil! d
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
332
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
333 " write tab to file
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
334 if a:really
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
335 let fnamepath= home."/".fname
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
336 " call Decho("exe w! ".fnameescape(fnamepath))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
337 if fenc != ""
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
338 exe "silent w! ++enc=".fnameescape(fenc)." ".fnameescape(fnamepath)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
339 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
340 exe "silent w! ".fnameescape(fnamepath)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
341 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
342 echo "wrote ".fnameescape(fnamepath)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
343 call s:RecordInVar(home,"call delete('".fnamepath."')")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
344 endif
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
345
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
346 " return to tab with vimball
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
347 " call Decho("exe tabn ".curtabnr)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
348 exe "tabn ".curtabnr
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
349
10228
8a1481e59d64 commit https://github.com/vim/vim/commit/3e496b0ea31996b665824f45664dee1fdd73c4d0
Christian Brabandt <cb@256bit.org>
parents: 8876
diff changeset
350 " set up help if it's a doc/*.txt file
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
351 " call Decho("didhelp<".didhelp."> fname<".fname.">")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
352 if a:really && didhelp == "" && fname =~ 'doc/[^/]\+\.\(txt\|..x\)$'
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
353 let didhelp= substitute(fname,'^\(.*\<doc\)[/\\][^.]*\.\(txt\|..x\)$','\1','')
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
354 " call Decho("didhelp<".didhelp.">")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
355 endif
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
356 endif
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
357
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
358 " update for next file
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
359 " call Decho("update linenr= [linenr=".linenr."] + [fsize=".fsize."] = ".(linenr+fsize))
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
360 let linenr= linenr + fsize
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
361 endwhile
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
362
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
363 " set up help
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
364 " call Decho("about to set up help: didhelp<".didhelp.">")
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
365 if didhelp != ""
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
366 let htpath= home."/".didhelp
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
367 " call Decho("exe helptags ".htpath)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
368 exe "helptags ".fnameescape(htpath)
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
369 echo "did helptags"
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
370 endif
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
371
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
372 " make sure a "Press ENTER..." prompt appears to keep the messages showing!
796
cc3902a09300 updated for version 7.0232
vimboss
parents: 792
diff changeset
373 while filecnt <= &ch
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
374 echomsg " "
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
375 let filecnt= filecnt + 1
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
376 endwhile
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
377
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
378 " record actions in <.VimballRecord>
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
379 call s:RecordInFile(home)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
380
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
381 " restore events, delete tab and buffer
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
382 exe "sil! tabn ".vbtabnr
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
383 setlocal nomod bh=wipe
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
384 exe "sil! tabn ".curtabnr
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
385 exe "sil! tabc! ".vbtabnr
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
386 call vimball#RestoreSettings()
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
387 call s:ChgDir(curdir)
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
388
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
389 " call Dret("vimball#Vimball")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
390 endfun
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
391
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
392 " ---------------------------------------------------------------------
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
393 " vimball#RmVimball: remove any files, remove any directories made by any {{{2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
394 " previous vimball extraction based on a file of the current
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
395 " name.
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
396 " Usage: RmVimball (assume current file is a vimball; remove)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
397 " RmVimball vimballname
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
398 fun! vimball#RmVimball(...)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
399 " call Dfunc("vimball#RmVimball() a:0=".a:0)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
400 if exists("g:vimball_norecord")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
401 " call Dret("vimball#RmVimball : (g:vimball_norecord)")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
402 return
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
403 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
404
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
405 if a:0 == 0
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
406 let curfile= expand("%:tr")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
407 " call Decho("case a:0=0: curfile<".curfile."> (used expand(%:tr))")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
408 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
409 if a:1 =~ '[\/]'
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
410 call vimball#ShowMesg(s:USAGE,"RmVimball vimballname [path]")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
411 " call Dret("vimball#RmVimball : suspect a:1<".a:1.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
412 return
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
413 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
414 let curfile= a:1
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
415 " call Decho("case a:0=".a:0.": curfile<".curfile.">")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
416 endif
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
417 if curfile =~ '\.vmb$'
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
418 let curfile= substitute(curfile,'\.vmb','','')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
419 elseif curfile =~ '\.vba$'
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
420 let curfile= substitute(curfile,'\.vba','','')
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
421 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
422 if a:0 >= 2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
423 let home= expand(a:2)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
424 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
425 let home= vimball#VimballHome()
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
426 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
427 let curdir = getcwd()
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
428 " call Decho("home <".home.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
429 " call Decho("curfile<".curfile.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
430 " call Decho("curdir <".curdir.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
431
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
432 call s:ChgDir(home)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
433 if filereadable(".VimballRecord")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
434 " call Decho(".VimballRecord is readable")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
435 " call Decho("curfile<".curfile.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
436 keepalt keepjumps 1split
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
437 sil! keepalt keepjumps e .VimballRecord
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
438 let keepsrch= @/
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
439 " call Decho('search for ^\M'.curfile.'.\m: ')
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
440 " call Decho('search for ^\M'.curfile.'.\m{vba|vmb}: ')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
441 " call Decho('search for ^\M'.curfile.'\m[-0-9.]*\.{vba|vmb}: ')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
442 if search('^\M'.curfile."\m: ".'cw')
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
443 let foundit= 1
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
444 elseif search('^\M'.curfile.".\mvmb: ",'cw')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
445 let foundit= 2
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
446 elseif search('^\M'.curfile.'\m[-0-9.]*\.vmb: ','cw')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
447 let foundit= 2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
448 elseif search('^\M'.curfile.".\mvba: ",'cw')
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
449 let foundit= 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
450 elseif search('^\M'.curfile.'\m[-0-9.]*\.vba: ','cw')
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
451 let foundit= 1
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
452 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
453 let foundit = 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
454 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
455 if foundit
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
456 if foundit == 1
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
457 let exestring = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vba: ','','')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
458 else
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
459 let exestring = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vmb: ','','')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
460 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
461 let s:VBRstring= substitute(exestring,'call delete(','','g')
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
462 let s:VBRstring= substitute(s:VBRstring,"[')]",'','g')
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
463 " call Decho("exe ".exestring)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
464 sil! keepalt keepjumps exe exestring
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
465 sil! keepalt keepjumps d
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
466 let exestring= strlen(substitute(exestring,'call delete(.\{-})|\=',"D","g"))
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
467 " call Decho("exestring<".exestring.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
468 echomsg "removed ".exestring." files"
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
469 else
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
470 let s:VBRstring= ''
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
471 let curfile = substitute(curfile,'\.vmb','','')
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
472 " call Decho("unable to find <".curfile."> in .VimballRecord")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
473 if !exists("s:ok_unablefind")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
474 call vimball#ShowMesg(s:WARNING,"(RmVimball) unable to find <".curfile."> in .VimballRecord")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
475 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
476 endif
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
477 sil! keepalt keepjumps g/^\s*$/d
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
478 sil! keepalt keepjumps wq!
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
479 let @/= keepsrch
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
480 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
481 call s:ChgDir(curdir)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
482
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
483 " call Dret("vimball#RmVimball")
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
484 endfun
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
485
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
486 " ---------------------------------------------------------------------
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
487 " vimball#Decompress: attempts to automatically decompress vimballs {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
488 fun! vimball#Decompress(fname,...)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
489 " call Dfunc("Decompress(fname<".a:fname.">) a:0=".a:0)
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
490
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
491 " decompression:
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
492 if expand("%") =~ '.*\.gz' && executable("gunzip")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
493 " handle *.gz with gunzip
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
494 silent exe "!gunzip ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
495 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
496 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) gunzip may have failed with <".a:fname.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
497 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
498 let fname= substitute(a:fname,'\.gz$','','')
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
499 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
500 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
501
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
502 elseif expand("%") =~ '.*\.gz' && executable("gzip")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
503 " handle *.gz with gzip -d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
504 silent exe "!gzip -d ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
505 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
506 call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "gzip -d" may have failed with <'.a:fname.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
507 endif
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
508 let fname= substitute(a:fname,'\.gz$','','')
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
509 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
510 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
511
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
512 elseif expand("%") =~ '.*\.bz2' && executable("bunzip2")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
513 " handle *.bz2 with bunzip2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
514 silent exe "!bunzip2 ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
515 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
516 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) bunzip2 may have failed with <".a:fname.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
517 endif
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
518 let fname= substitute(a:fname,'\.bz2$','','')
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
519 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
520 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
521
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
522 elseif expand("%") =~ '.*\.bz2' && executable("bzip2")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
523 " handle *.bz2 with bzip2 -d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
524 silent exe "!bzip2 -d ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
525 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
526 call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "bzip2 -d" may have failed with <'.a:fname.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
527 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
528 let fname= substitute(a:fname,'\.bz2$','','')
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
529 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
530 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
531
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
532 elseif expand("%") =~ '.*\.zip' && executable("unzip")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
533 " handle *.zip with unzip
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
534 silent exe "!unzip ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
535 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
536 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) unzip may have failed with <".a:fname.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
537 endif
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
538 let fname= substitute(a:fname,'\.zip$','','')
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
539 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
540 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
541 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
542
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
543 if a:0 == 0| setlocal noma bt=nofile fmr=[[[,]]] fdm=marker | endif
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
544
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
545 " call Dret("Decompress")
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
546 endfun
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
547
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
548 " ---------------------------------------------------------------------
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
549 " vimball#ShowMesg: {{{2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
550 fun! vimball#ShowMesg(level,msg)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
551 " call Dfunc("vimball#ShowMesg(level=".a:level." msg<".a:msg.">)")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
552
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
553 let rulerkeep = &ruler
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
554 let showcmdkeep = &showcmd
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
555 set noruler noshowcmd
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
556 redraw!
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
557
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
558 if &fo =~# '[ta]'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
559 echomsg "***vimball*** ".a:msg
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
560 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
561 if a:level == s:WARNING || a:level == s:USAGE
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
562 echohl WarningMsg
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
563 elseif a:level == s:ERROR
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
564 echohl Error
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
565 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
566 echomsg "***vimball*** ".a:msg
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
567 echohl None
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
568 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
569
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
570 if a:level != s:USAGE
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
571 call inputsave()|let ok= input("Press <cr> to continue")|call inputrestore()
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
572 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
573
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
574 let &ruler = rulerkeep
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
575 let &showcmd = showcmdkeep
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
576
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
577 " call Dret("vimball#ShowMesg")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
578 endfun
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
579 " =====================================================================
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
580 " s:ChgDir: change directory (in spite of Windoze) {{{2
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
581 fun! s:ChgDir(newdir)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
582 " call Dfunc("ChgDir(newdir<".a:newdir.">)")
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
583 if (has("win32") || has("win95") || has("win64") || has("win16"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
584 try
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
585 exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g'))
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
586 catch /^Vim\%((\a\+)\)\=:E/
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
587 call mkdir(fnameescape(substitute(a:newdir,'/','\\','g')))
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
588 exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g'))
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
589 endtry
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
590 else
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
591 try
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
592 exe 'silent cd '.fnameescape(a:newdir)
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
593 catch /^Vim\%((\a\+)\)\=:E/
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
594 call mkdir(fnameescape(a:newdir))
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
595 exe 'silent cd '.fnameescape(a:newdir)
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
596 endtry
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
597 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
598 " call Dret("ChgDir : curdir<".getcwd().">")
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
599 endfun
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
600
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
601 " ---------------------------------------------------------------------
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
602 " s:RecordInVar: record a un-vimball command in the .VimballRecord file {{{2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
603 fun! s:RecordInVar(home,cmd)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
604 " call Dfunc("RecordInVar(home<".a:home."> cmd<".a:cmd.">)")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
605 if a:cmd =~ '^rmdir'
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
606 " if !exists("s:recorddir")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
607 " let s:recorddir= substitute(a:cmd,'^rmdir',"call s:Rmdir",'')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
608 " else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
609 " let s:recorddir= s:recorddir."|".substitute(a:cmd,'^rmdir',"call s:Rmdir",'')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
610 " endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
611 elseif !exists("s:recordfile")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
612 let s:recordfile= a:cmd
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
613 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
614 let s:recordfile= s:recordfile."|".a:cmd
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
615 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
616 " call Dret("RecordInVar : s:recordfile<".(exists("s:recordfile")? s:recordfile : "")."> s:recorddir<".(exists("s:recorddir")? s:recorddir : "").">")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
617 endfun
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
618
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
619 " ---------------------------------------------------------------------
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
620 " s:RecordInFile: {{{2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
621 fun! s:RecordInFile(home)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
622 " call Dfunc("s:RecordInFile()")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
623 if exists("g:vimball_norecord")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
624 " call Dret("s:RecordInFile : g:vimball_norecord")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
625 return
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
626 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
627
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
628 if exists("s:recordfile") || exists("s:recorddir")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
629 let curdir= getcwd()
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
630 call s:ChgDir(a:home)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
631 keepalt keepjumps 1split
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
632
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
633 let cmd= expand("%:tr").": "
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
634 " call Decho("cmd<".cmd.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
635
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
636 sil! keepalt keepjumps e .VimballRecord
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
637 setlocal ma
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
638 $
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
639 if exists("s:recordfile") && exists("s:recorddir")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
640 let cmd= cmd.s:recordfile."|".s:recorddir
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
641 elseif exists("s:recorddir")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
642 let cmd= cmd.s:recorddir
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
643 elseif exists("s:recordfile")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
644 let cmd= cmd.s:recordfile
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
645 else
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
646 " call Dret("s:RecordInFile : neither recordfile nor recorddir exist")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
647 return
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
648 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
649 " call Decho("cmd<".cmd.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
650
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
651 " put command into buffer, write .VimballRecord `file
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
652 keepalt keepjumps put=cmd
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
653 sil! keepalt keepjumps g/^\s*$/d
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
654 sil! keepalt keepjumps wq!
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
655 call s:ChgDir(curdir)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
656
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
657 if exists("s:recorddir")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
658 " call Decho("unlet s:recorddir<".s:recorddir.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
659 unlet s:recorddir
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
660 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
661 if exists("s:recordfile")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
662 " call Decho("unlet s:recordfile<".s:recordfile.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
663 unlet s:recordfile
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
664 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
665 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
666 " call Decho("s:record[file|dir] doesn't exist")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
667 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
668
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
669 " call Dret("s:RecordInFile")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
670 endfun
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
671
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
672 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
673 " vimball#VimballHome: determine/get home directory path (usually from rtp) {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
674 fun! vimball#VimballHome()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
675 " call Dfunc("vimball#VimballHome()")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
676 if exists("g:vimball_home")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
677 let home= g:vimball_home
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
678 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
679 " go to vim plugin home
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
680 for home in split(&rtp,',') + ['']
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
681 if isdirectory(home) && filewritable(home) | break | endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
682 let basehome= substitute(home,'[/\\]\.vim$','','')
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
683 if isdirectory(basehome) && filewritable(basehome)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
684 let home= basehome."/.vim"
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
685 break
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
686 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
687 endfor
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
688 if home == ""
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
689 " just pick the first directory
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
690 let home= substitute(&rtp,',.*$','','')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
691 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
692 if (has("win32") || has("win95") || has("win64") || has("win16"))
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
693 let home= substitute(home,'/','\\','g')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
694 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
695 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
696 " insure that the home directory exists
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
697 " call Decho("picked home<".home.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
698 if !isdirectory(home)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
699 if exists("g:vimball_mkdir")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
700 " call Decho("home<".home."> isn't a directory -- making it now with g:vimball_mkdir<".g:vimball_mkdir.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
701 " call Decho("system(".g:vimball_mkdir." ".shellescape(home).")")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
702 call system(g:vimball_mkdir." ".shellescape(home))
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
703 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
704 " call Decho("home<".home."> isn't a directory -- making it now with mkdir()")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
705 call mkdir(home)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
706 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
707 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
708 " call Dret("vimball#VimballHome <".home.">")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
709 return home
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
710 endfun
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
711
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
712 " ---------------------------------------------------------------------
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
713 " vimball#SaveSettings: {{{2
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
714 fun! vimball#SaveSettings()
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
715 " call Dfunc("SaveSettings()")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
716 let s:makeep = getpos("'a")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
717 let s:regakeep= @a
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
718 if exists("+acd")
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
719 let s:acdkeep = &acd
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
720 endif
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
721 let s:eikeep = &ei
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
722 let s:fenkeep = &l:fen
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
723 let s:hidkeep = &hidden
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
724 let s:ickeep = &ic
1186
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 1118
diff changeset
725 let s:lzkeep = &lz
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 1118
diff changeset
726 let s:pmkeep = &pm
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
727 let s:repkeep = &report
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
728 let s:vekeep = &ve
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
729 let s:ffkeep = &l:ff
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
730 let s:swfkeep = &l:swf
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
731 if exists("+acd")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
732 setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
733 else
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
734 setlocal ei=all ve=all nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
735 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
736 " vimballs should be in unix format
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
737 setlocal ff=unix
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
738 " call Dret("SaveSettings")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
739 endfun
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
740
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
741 " ---------------------------------------------------------------------
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
742 " vimball#RestoreSettings: {{{2
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
743 fun! vimball#RestoreSettings()
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
744 " call Dfunc("RestoreSettings()")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
745 let @a = s:regakeep
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
746 if exists("+acd")
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
747 let &acd = s:acdkeep
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
748 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
749 let &l:fen = s:fenkeep
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
750 let &hidden = s:hidkeep
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
751 let &ic = s:ickeep
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
752 let &lz = s:lzkeep
1186
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 1118
diff changeset
753 let &pm = s:pmkeep
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
754 let &report = s:repkeep
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
755 let &ve = s:vekeep
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
756 let &ei = s:eikeep
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
757 let &l:ff = s:ffkeep
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
758 if s:makeep[0] != 0
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
759 " restore mark a
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
760 " call Decho("restore mark-a: makeep=".string(makeep))
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
761 call setpos("'a",s:makeep)
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
762 endif
8876
47f17f66da3d commit https://github.com/vim/vim/commit/03413f44167c4b5cd0012def9bb331e2518c83cf
Christian Brabandt <cb@256bit.org>
parents: 3281
diff changeset
763 if exists("+acd")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
764 unlet s:acdkeep
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
765 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
766 unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep s:ffkeep
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
767 " call Dret("RestoreSettings")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
768 endfun
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
769
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
770 let &cpo = s:keepcpo
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
771 unlet s:keepcpo
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
772
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
773 " ---------------------------------------------------------------------
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
774 " Modelines: {{{1
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
775 " vim: fdm=marker