annotate runtime/autoload/vimball.vim @ 3018:45ead8a0bede v7.3.281

updated for version 7.3.281 Problem: After using "expand('%:8')" the buffer name is changed. Solution: Make a copy of the file name before shortening it.
author Bram Moolenaar <bram@vim.org>
date Wed, 17 Aug 2011 15:23:23 +0200
parents fd09a9c8468e
children 37ecb8ff4560
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
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
2 " Author: Charles E. Campbell, Jr.
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3 " Date: Apr 02, 2011
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
4 " Version: 33
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
5 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6 " Copyright: (c) 2004-2011 by Charles E. Campbell, Jr.
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
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
17 let g:loaded_vimball = "v33"
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("$") == ""
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
145 call setline(1,'" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.')
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
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
182 exe "tabc ".vbtabnr
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
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
223 let home= expand(a:1)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
224 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
225 let home= vimball#VimballHome()
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
226 endif
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
227 " call Decho("home<".home.">")
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
228
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
229 " save current directory and remove older same-named vimball, if any
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
230 let curdir = getcwd()
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
231 " call Decho("home<".home.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
232 " call Decho("curdir<".curdir.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
233
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
234 call s:ChgDir(home)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
235 let s:ok_unablefind= 1
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
236 call vimball#RmVimball(vimballfile)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
237 unlet s:ok_unablefind
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
238
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
239 let linenr = 4
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
240 let filecnt = 0
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
241
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
242 " give title to listing of (extracted) files from Vimball Archive
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
243 if a:really
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
244 echohl Title | echomsg "Vimball Archive" | echohl None
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
245 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
246 echohl Title | echomsg "Vimball Archive Listing" | echohl None
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
247 echohl Statement | echomsg "files would be placed under: ".home | echohl None
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
248 endif
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
249
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
250 " apportion vimball contents to various files
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
251 " call Decho("exe tabn ".curtabnr)
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
252 exe "tabn ".curtabnr
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
253 " call Decho("linenr=".linenr." line$=".line("$"))
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
254 while 1 < linenr && linenr < line("$")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
255 let fname = substitute(getline(linenr),'\t\[\[\[1$','','')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
256 let fname = substitute(fname,'\\','/','g')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
257 let fsize = substitute(getline(linenr+1),'^\(\d\+\).\{-}$','\1','')+0
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
258 let fenc = substitute(getline(linenr+1),'^\d\+\s*\(\S\{-}\)$','\1','')
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
259 let filecnt = filecnt + 1
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
260 " call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt. " fenc=".fenc)
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
261
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
262 if a:really
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
263 echomsg "extracted <".fname.">: ".fsize." lines"
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
264 else
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
265 echomsg "would extract <".fname.">: ".fsize." lines"
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
266 endif
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
267 " call Decho("using L#".linenr.": will extract file<".fname.">")
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
268 " call Decho("using L#".(linenr+1).": fsize=".fsize)
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
269
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
270 " Allow AsNeeded/ directory to take place of plugin/ directory
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
271 " when AsNeeded/filename is filereadable or was present in VimballRecord
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
272 if fname =~ '\<plugin/'
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
273 let anfname= substitute(fname,'\<plugin/','AsNeeded/','')
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
274 if filereadable(anfname) || (exists("s:VBRstring") && s:VBRstring =~ anfname)
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
275 " call Decho("using anfname<".anfname."> instead of <".fname.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
276 let fname= anfname
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
277 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
278 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
279
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
280 " make directories if they don't exist yet
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
281 if a:really
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
282 " call Decho("making directories if they don't exist yet (fname<".fname.">)")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
283 let fnamebuf= substitute(fname,'\\','/','g')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
284 let dirpath = substitute(home,'\\','/','g')
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
285 while fnamebuf =~ '/'
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
286 let dirname = dirpath."/".substitute(fnamebuf,'/.*$','','')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
287 let dirpath = dirname
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
288 let fnamebuf = substitute(fnamebuf,'^.\{-}/\(.*\)$','\1','')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
289 " call Decho("dirname<".dirname.">")
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
290 if !isdirectory(dirname)
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
291 " call Decho("making <".dirname.">")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
292 if exists("g:vimball_mkdir")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
293 call system(g:vimball_mkdir." ".shellescape(dirname))
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
294 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
295 call mkdir(dirname)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
296 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
297 call s:RecordInVar(home,"rmdir('".dirname."')")
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
298 endif
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
299 endwhile
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
300 endif
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
301 call s:ChgDir(home)
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
302
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
303 " grab specified qty of lines and place into "a" buffer
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
304 " (skip over path/filename and qty-lines)
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
305 let linenr = linenr + 2
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
306 let lastline = linenr + fsize - 1
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
307 " call Decho("exe ".linenr.",".lastline."yank a")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
308 " no point in handling a zero-length file
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
309 if lastline >= linenr
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
310 exe "silent ".linenr.",".lastline."yank a"
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
311
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
312 " copy "a" buffer into tab
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
313 " call Decho('copy "a buffer into tab#'.vbtabnr)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
314 exe "tabn ".vbtabnr
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
315 setlocal ma
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
316 sil! %d
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
317 silent put a
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
318 1
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
319 sil! d
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
320
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
321 " write tab to file
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
322 if a:really
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
323 let fnamepath= home."/".fname
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
324 " call Decho("exe w! ".fnameescape(fnamepath))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
325 if fenc != ""
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
326 exe "silent w! ++enc=".fnameescape(fenc)." ".fnameescape(fnamepath)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
327 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
328 exe "silent w! ".fnameescape(fnamepath)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
329 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
330 echo "wrote ".fnameescape(fnamepath)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
331 call s:RecordInVar(home,"call delete('".fnamepath."')")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
332 endif
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
333
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
334 " return to tab with vimball
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
335 " call Decho("exe tabn ".curtabnr)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
336 exe "tabn ".curtabnr
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
337
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
338 " set up help if its a doc/*.txt file
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
339 " call Decho("didhelp<".didhelp."> fname<".fname.">")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
340 if a:really && didhelp == "" && fname =~ 'doc/[^/]\+\.\(txt\|..x\)$'
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
341 let didhelp= substitute(fname,'^\(.*\<doc\)[/\\][^.]*\.\(txt\|..x\)$','\1','')
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
342 " call Decho("didhelp<".didhelp.">")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
343 endif
842
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
344 endif
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
345
a209672376fd updated for version 7.0f
vimboss
parents: 819
diff changeset
346 " update for next file
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
347 " call Decho("update linenr= [linenr=".linenr."] + [fsize=".fsize."] = ".(linenr+fsize))
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
348 let linenr= linenr + fsize
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
349 endwhile
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
350
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
351 " set up help
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
352 " call Decho("about to set up help: didhelp<".didhelp.">")
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
353 if didhelp != ""
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
354 let htpath= home."/".didhelp
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
355 " call Decho("exe helptags ".htpath)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
356 exe "helptags ".fnameescape(htpath)
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
357 echo "did helptags"
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
358 endif
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
359
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
360 " make sure a "Press ENTER..." prompt appears to keep the messages showing!
796
cc3902a09300 updated for version 7.0232
vimboss
parents: 792
diff changeset
361 while filecnt <= &ch
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
362 echomsg " "
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
363 let filecnt= filecnt + 1
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
364 endwhile
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
365
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
366 " record actions in <.VimballRecord>
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
367 call s:RecordInFile(home)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
368
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
369 " restore events, delete tab and buffer
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
370 exe "tabn ".vbtabnr
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
371 setlocal nomod bh=wipe
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
372 exe "tabn ".curtabnr
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
373 exe "tabc ".vbtabnr
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
374 call vimball#RestoreSettings()
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
375 call s:ChgDir(curdir)
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
376
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
377 " call Dret("vimball#Vimball")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
378 endfun
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
379
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
380 " ---------------------------------------------------------------------
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
381 " vimball#RmVimball: remove any files, remove any directories made by any {{{2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
382 " previous vimball extraction based on a file of the current
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
383 " name.
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
384 " Usage: RmVimball (assume current file is a vimball; remove)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
385 " RmVimball vimballname
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
386 fun! vimball#RmVimball(...)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
387 " call Dfunc("vimball#RmVimball() a:0=".a:0)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
388 if exists("g:vimball_norecord")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
389 " call Dret("vimball#RmVimball : (g:vimball_norecord)")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
390 return
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
391 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
392
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
393 if a:0 == 0
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
394 let curfile= expand("%:tr")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
395 " call Decho("case a:0=0: curfile<".curfile."> (used expand(%:tr))")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
396 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
397 if a:1 =~ '[\/]'
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
398 call vimball#ShowMesg(s:USAGE,"RmVimball vimballname [path]")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
399 " call Dret("vimball#RmVimball : suspect a:1<".a:1.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
400 return
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
401 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
402 let curfile= a:1
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
403 " call Decho("case a:0=".a:0.": curfile<".curfile.">")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
404 endif
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
405 if curfile =~ '\.vmb$'
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
406 let curfile= substitute(curfile,'\.vmb','','')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
407 elseif curfile =~ '\.vba$'
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
408 let curfile= substitute(curfile,'\.vba','','')
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
409 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
410 if a:0 >= 2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
411 let home= expand(a:2)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
412 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
413 let home= vimball#VimballHome()
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
414 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
415 let curdir = getcwd()
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
416 " call Decho("home <".home.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
417 " call Decho("curfile<".curfile.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
418 " call Decho("curdir <".curdir.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
419
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
420 call s:ChgDir(home)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
421 if filereadable(".VimballRecord")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
422 " call Decho(".VimballRecord is readable")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
423 " call Decho("curfile<".curfile.">")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
424 keepalt keepjumps 1split
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
425 sil! keepalt keepjumps e .VimballRecord
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
426 let keepsrch= @/
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
427 " call Decho('search for ^\M'.curfile.'.\m: ')
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
428 " call Decho('search for ^\M'.curfile.'.\m{vba|vmb}: ')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
429 " 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
430 if search('^\M'.curfile."\m: ".'cw')
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
431 let foundit= 1
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
432 elseif search('^\M'.curfile.".\mvmb: ",'cw')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
433 let foundit= 2
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
434 elseif search('^\M'.curfile.'\m[-0-9.]*\.vmb: ','cw')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
435 let foundit= 2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
436 elseif search('^\M'.curfile.".\mvba: ",'cw')
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
437 let foundit= 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
438 elseif search('^\M'.curfile.'\m[-0-9.]*\.vba: ','cw')
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
439 let foundit= 1
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
440 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
441 let foundit = 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
442 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
443 if foundit
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
444 if foundit == 1
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
445 let exestring = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vba: ','','')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
446 else
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
447 let exestring = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vmb: ','','')
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
448 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
449 let s:VBRstring= substitute(exestring,'call delete(','','g')
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
450 let s:VBRstring= substitute(s:VBRstring,"[')]",'','g')
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
451 " call Decho("exe ".exestring)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
452 sil! keepalt keepjumps exe exestring
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
453 sil! keepalt keepjumps d
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
454 let exestring= strlen(substitute(exestring,'call delete(.\{-})|\=',"D","g"))
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
455 " call Decho("exestring<".exestring.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
456 echomsg "removed ".exestring." files"
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
457 else
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
458 let s:VBRstring= ''
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
459 let curfile = substitute(curfile,'\.vmb','','')
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
460 " call Decho("unable to find <".curfile."> in .VimballRecord")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
461 if !exists("s:ok_unablefind")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
462 call vimball#ShowMesg(s:WARNING,"(RmVimball) unable to find <".curfile."> in .VimballRecord")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
463 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
464 endif
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
465 sil! keepalt keepjumps g/^\s*$/d
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
466 sil! keepalt keepjumps wq!
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
467 let @/= keepsrch
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
468 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
469 call s:ChgDir(curdir)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
470
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
471 " call Dret("vimball#RmVimball")
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
472 endfun
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
473
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
474 " ---------------------------------------------------------------------
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
475 " vimball#Decompress: attempts to automatically decompress vimballs {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
476 fun! vimball#Decompress(fname,...)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
477 " call Dfunc("Decompress(fname<".a:fname.">) a:0=".a:0)
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
478
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
479 " decompression:
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
480 if expand("%") =~ '.*\.gz' && executable("gunzip")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
481 " handle *.gz with gunzip
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
482 silent exe "!gunzip ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
483 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
484 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
485 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
486 let fname= substitute(a:fname,'\.gz$','','')
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
487 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
488 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
489
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
490 elseif expand("%") =~ '.*\.gz' && executable("gzip")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
491 " handle *.gz with gzip -d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
492 silent exe "!gzip -d ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
493 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
494 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
495 endif
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
496 let fname= substitute(a:fname,'\.gz$','','')
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
497 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
498 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
499
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
500 elseif expand("%") =~ '.*\.bz2' && executable("bunzip2")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
501 " handle *.bz2 with bunzip2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
502 silent exe "!bunzip2 ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
503 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
504 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
505 endif
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
506 let fname= substitute(a:fname,'\.bz2$','','')
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
507 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
508 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
509
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
510 elseif expand("%") =~ '.*\.bz2' && executable("bzip2")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
511 " handle *.bz2 with bzip2 -d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
512 silent exe "!bzip2 -d ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
513 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
514 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
515 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
516 let fname= substitute(a:fname,'\.bz2$','','')
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
517 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
518 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
519
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
520 elseif expand("%") =~ '.*\.zip' && executable("unzip")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
521 " handle *.zip with unzip
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
522 silent exe "!unzip ".shellescape(a:fname)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
523 if v:shell_error != 0
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
524 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
525 endif
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
526 let fname= substitute(a:fname,'\.zip$','','')
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
527 exe "e ".escape(fname,' \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
528 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
529 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
530
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
531 if a:0 == 0| setlocal noma bt=nofile fmr=[[[,]]] fdm=marker | endif
843
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
532
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
533 " call Dret("Decompress")
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
534 endfun
9f279ebda751 updated for version 7.0f01
vimboss
parents: 842
diff changeset
535
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
536 " ---------------------------------------------------------------------
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
537 " vimball#ShowMesg: {{{2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
538 fun! vimball#ShowMesg(level,msg)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
539 " call Dfunc("vimball#ShowMesg(level=".a:level." msg<".a:msg.">)")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
540
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
541 let rulerkeep = &ruler
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
542 let showcmdkeep = &showcmd
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
543 set noruler noshowcmd
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
544 redraw!
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
545
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
546 if &fo =~ '[ta]'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
547 echomsg "***vimball*** ".a:msg
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
548 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
549 if a:level == s:WARNING || a:level == s:USAGE
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
550 echohl WarningMsg
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
551 elseif a:level == s:ERROR
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
552 echohl Error
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
553 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
554 echomsg "***vimball*** ".a:msg
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
555 echohl None
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
556 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
557
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
558 if a:level != s:USAGE
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
559 call inputsave()|let ok= input("Press <cr> to continue")|call inputrestore()
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
560 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
561
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
562 let &ruler = rulerkeep
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
563 let &showcmd = showcmdkeep
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
564
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
565 " call Dret("vimball#ShowMesg")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
566 endfun
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
567 " =====================================================================
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
568 " s:ChgDir: change directory (in spite of Windoze) {{{2
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
569 fun! s:ChgDir(newdir)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
570 " call Dfunc("ChgDir(newdir<".a:newdir.">)")
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
571 if (has("win32") || has("win95") || has("win64") || has("win16"))
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
572 exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g'))
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
573 else
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
574 exe 'silent cd '.fnameescape(a:newdir)
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
575 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
576 " call Dret("ChgDir : curdir<".getcwd().">")
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
577 endfun
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
578
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
579 " ---------------------------------------------------------------------
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
580 " s:RecordInVar: record a un-vimball command in the .VimballRecord file {{{2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
581 fun! s:RecordInVar(home,cmd)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
582 " call Dfunc("RecordInVar(home<".a:home."> cmd<".a:cmd.">)")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
583 if a:cmd =~ '^rmdir'
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
584 " if !exists("s:recorddir")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
585 " let s:recorddir= substitute(a:cmd,'^rmdir',"call s:Rmdir",'')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
586 " else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
587 " let s:recorddir= s:recorddir."|".substitute(a:cmd,'^rmdir',"call s:Rmdir",'')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
588 " endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
589 elseif !exists("s:recordfile")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
590 let s:recordfile= a:cmd
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
591 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
592 let s:recordfile= s:recordfile."|".a:cmd
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
593 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
594 " 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
595 endfun
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
596
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
597 " ---------------------------------------------------------------------
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
598 " s:RecordInFile: {{{2
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
599 fun! s:RecordInFile(home)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
600 " call Dfunc("s:RecordInFile()")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
601 if exists("g:vimball_norecord")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
602 " call Dret("s:RecordInFile : g:vimball_norecord")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
603 return
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
604 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
605
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
606 if exists("s:recordfile") || exists("s:recorddir")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
607 let curdir= getcwd()
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
608 call s:ChgDir(a:home)
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
609 keepalt keepjumps 1split
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
610
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
611 let cmd= expand("%:tr").": "
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
612 " call Decho("cmd<".cmd.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
613
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
614 sil! keepalt keepjumps e .VimballRecord
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
615 setlocal ma
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
616 $
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
617 if exists("s:recordfile") && exists("s:recorddir")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
618 let cmd= cmd.s:recordfile."|".s:recorddir
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
619 elseif exists("s:recorddir")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
620 let cmd= cmd.s:recorddir
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
621 elseif exists("s:recordfile")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
622 let cmd= cmd.s:recordfile
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
623 else
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
624 " call Dret("s:RecordInFile : neither recordfile nor recorddir exist")
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
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
627 " call Decho("cmd<".cmd.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
628
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
629 " put command into buffer, write .VimballRecord `file
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
630 keepalt keepjumps put=cmd
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
631 sil! keepalt keepjumps g/^\s*$/d
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
632 sil! keepalt keepjumps wq!
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
633 call s:ChgDir(curdir)
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
634
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
635 if exists("s:recorddir")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
636 " call Decho("unlet s:recorddir<".s:recorddir.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
637 unlet s:recorddir
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
638 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
639 if exists("s:recordfile")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
640 " call Decho("unlet s:recordfile<".s:recordfile.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
641 unlet s:recordfile
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
642 endif
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
643 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
644 " call Decho("s:record[file|dir] doesn't exist")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
645 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
646
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
647 " call Dret("s:RecordInFile")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
648 endfun
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
649
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
650 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
651 " vimball#VimballHome: determine/get home directory path (usually from rtp) {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
652 fun! vimball#VimballHome()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
653 " call Dfunc("vimball#VimballHome()")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
654 if exists("g:vimball_home")
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
655 let home= g:vimball_home
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
656 else
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
657 " go to vim plugin home
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
658 for home in split(&rtp,',') + ['']
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
659 if isdirectory(home) && filewritable(home) | break | endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
660 let basehome= substitute(home,'[/\\]\.vim$','','')
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
661 if isdirectory(basehome) && filewritable(basehome)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
662 let home= basehome."/.vim"
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
663 break
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 endfor
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
666 if home == ""
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
667 " just pick the first directory
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
668 let home= substitute(&rtp,',.*$','','')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
669 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
670 if (has("win32") || has("win95") || has("win64") || has("win16"))
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
671 let home= substitute(home,'/','\\','g')
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
672 endif
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
673 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
674 " insure that the home directory exists
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
675 " call Decho("picked home<".home.">")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
676 if !isdirectory(home)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
677 if exists("g:vimball_mkdir")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
678 " 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
679 " call Decho("system(".g:vimball_mkdir." ".shellescape(home).")")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
680 call system(g:vimball_mkdir." ".shellescape(home))
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
681 else
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
682 " call Decho("home<".home."> isn't a directory -- making it now with mkdir()")
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
683 call mkdir(home)
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
684 endif
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
685 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
686 " call Dret("vimball#VimballHome <".home.">")
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
687 return home
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
688 endfun
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
689
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 843
diff changeset
690 " ---------------------------------------------------------------------
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
691 " vimball#SaveSettings: {{{2
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
692 fun! vimball#SaveSettings()
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
693 " call Dfunc("SaveSettings()")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
694 let s:makeep = getpos("'a")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
695 let s:regakeep= @a
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
696 if exists("&acd")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
697 let s:acdkeep = &acd
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
698 endif
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
699 let s:eikeep = &ei
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
700 let s:fenkeep = &l:fen
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
701 let s:hidkeep = &hidden
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
702 let s:ickeep = &ic
1186
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 1118
diff changeset
703 let s:lzkeep = &lz
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 1118
diff changeset
704 let s:pmkeep = &pm
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
705 let s:repkeep = &report
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
706 let s:vekeep = &ve
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
707 let s:ffkeep = &l:ff
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
708 let s:swfkeep = &l:swf
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
709 if exists("&acd")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
710 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
711 else
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
712 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
713 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
714 " vimballs should be in unix format
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
715 setlocal ff=unix
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
716 " call Dret("SaveSettings")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
717 endfun
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
718
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
719 " ---------------------------------------------------------------------
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
720 " vimball#RestoreSettings: {{{2
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
721 fun! vimball#RestoreSettings()
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
722 " call Dfunc("RestoreSettings()")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
723 let @a = s:regakeep
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
724 if exists("&acd")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
725 let &acd = s:acdkeep
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
726 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
727 let &l:fen = s:fenkeep
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
728 let &hidden = s:hidkeep
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
729 let &ic = s:ickeep
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
730 let &lz = s:lzkeep
1186
2de44d8f2cf1 updated for version 7.1b
vimboss
parents: 1118
diff changeset
731 let &pm = s:pmkeep
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
732 let &report = s:repkeep
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
733 let &ve = s:vekeep
1118
2b8ff9e3c520 updated for version 7.1a
vimboss
parents: 857
diff changeset
734 let &ei = s:eikeep
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1618
diff changeset
735 let &l:ff = s:ffkeep
845
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
736 if s:makeep[0] != 0
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
737 " restore mark a
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
738 " call Decho("restore mark-a: makeep=".string(makeep))
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
739 call setpos("'a",s:makeep)
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
740 endif
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
741 if exists("&acd")
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
742 unlet s:acdkeep
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 845
diff changeset
743 endif
1618
46bbe11644e0 updated for version 7.2a
vimboss
parents: 1186
diff changeset
744 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
745 " call Dret("RestoreSettings")
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
746 endfun
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
747
0fe7765dcb8e updated for version 7.0f03
vimboss
parents: 844
diff changeset
748 " ---------------------------------------------------------------------
792
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
749 " Modelines: {{{1
860b73800cd7 updated for version 7.0231
vimboss
parents:
diff changeset
750 " vim: fdm=marker