Mercurial > vim
comparison runtime/autoload/vimball.vim @ 1698:f4f8014d516e v7.2c.000
updated for version 7.2c-000
author | vimboss |
---|---|
date | Wed, 06 Aug 2008 17:06:04 +0000 |
parents | 46bbe11644e0 |
children | 7bc41231fbc7 |
comparison
equal
deleted
inserted
replaced
1697:2f9308b31181 | 1698:f4f8014d516e |
---|---|
1 " vimball.vim : construct a file containing both paths and files | 1 " vimball.vim : construct a file containing both paths and files |
2 " Author: Charles E. Campbell, Jr. | 2 " Author: Charles E. Campbell, Jr. |
3 " Date: Jun 05, 2008 | 3 " Date: Jul 30, 2008 |
4 " Version: 27 | 4 " Version: 29 |
5 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim | 5 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim |
6 " Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. | 6 " Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. |
7 " The VIM LICENSE applies to Vimball.vim, and Vimball.txt | 7 " The VIM LICENSE applies to Vimball.vim, and Vimball.txt |
8 " (see |copyright|) except use "Vimball" instead of "Vim". | 8 " (see |copyright|) except use "Vimball" instead of "Vim". |
9 " No warranty, express or implied. | 9 " No warranty, express or implied. |
13 " Load Once: {{{1 | 13 " Load Once: {{{1 |
14 if &cp || exists("g:loaded_vimball") || v:version < 700 | 14 if &cp || exists("g:loaded_vimball") || v:version < 700 |
15 finish | 15 finish |
16 endif | 16 endif |
17 let s:keepcpo = &cpo | 17 let s:keepcpo = &cpo |
18 let g:loaded_vimball = "v27" | 18 let g:loaded_vimball = "v29" |
19 set cpo&vim | 19 set cpo&vim |
20 "DechoTabOn | 20 "DechoTabOn |
21 | 21 |
22 " ===================================================================== | 22 " ===================================================================== |
23 " Constants: {{{1 | 23 " Constants: {{{1 |
167 endif | 167 endif |
168 call setline(lastline ,substitute(svfile,'$',' [[[1','')) | 168 call setline(lastline ,substitute(svfile,'$',' [[[1','')) |
169 call setline(lastline+1,0) | 169 call setline(lastline+1,0) |
170 | 170 |
171 " write the file from the tab | 171 " write the file from the tab |
172 let svfilepath= s:Path(svfile,'') | 172 " call Decho("exe $r ".fnameescape(svfile)) |
173 " call Decho("exe $r ".fnameescape(svfilepath)) | 173 exe "$r ".fnameescape(svfile) |
174 exe "$r ".fnameescape(svfilepath) | |
175 | 174 |
176 call setline(lastline+1,line("$") - lastline - 1) | 175 call setline(lastline+1,line("$") - lastline - 1) |
177 " call Decho("lastline=".lastline." line$=".line("$")) | 176 " call Decho("lastline=".lastline." line$=".line("$")) |
178 | 177 |
179 " restore to normal tab | 178 " restore to normal tab |
184 " write the vimball | 183 " write the vimball |
185 exe "tabn ".vbtabnr | 184 exe "tabn ".vbtabnr |
186 call s:ChgDir(curdir) | 185 call s:ChgDir(curdir) |
187 setlocal ff=unix | 186 setlocal ff=unix |
188 if a:writelevel | 187 if a:writelevel |
189 let vbnamepath= s:Path(vbname,'') | 188 " call Decho("exe w! ".fnameescape(vbname)) |
190 " call Decho("exe w! ".fnameescape(vbnamepath)) | 189 exe "w! ".fnameescape(vbname) |
191 exe "w! ".fnameescape(vbnamepath) | 190 else |
192 else | 191 " call Decho("exe w ".fnameescape(vbname)) |
193 let vbnamepath= s:Path(vbname,'') | 192 exe "w ".fnameescape(vbname) |
194 " call Decho("exe w ".fnameescape(vbnamepath)) | |
195 exe "w ".fnameescape(vbnamepath) | |
196 endif | 193 endif |
197 " call Decho("Vimball<".vbname."> created") | 194 " call Decho("Vimball<".vbname."> created") |
198 echo "Vimball<".vbname."> created" | 195 echo "Vimball<".vbname."> created" |
199 | 196 |
200 " remove the evidence | 197 " remove the evidence |
213 " (invoked the the UseVimball command embedded in | 210 " (invoked the the UseVimball command embedded in |
214 " vimballs' prologue) | 211 " vimballs' prologue) |
215 fun! vimball#Vimball(really,...) | 212 fun! vimball#Vimball(really,...) |
216 " call Dfunc("vimball#Vimball(really=".a:really.") a:0=".a:0) | 213 " call Dfunc("vimball#Vimball(really=".a:really.") a:0=".a:0) |
217 | 214 |
218 if v:version < 701 || (v:version == 701 && !has("patch299")) | 215 if v:version < 701 || (v:version == 701 && !exists('*fnameescape')) |
219 echoerr "This version of vimball requires vim 7.1 with patch 299" | 216 echoerr "your vim is missing the fnameescape() function" |
220 " call Dret("vimball#Vimball : needs 7.1 with patch 299") | 217 " call Dret("vimball#Vimball : needs 7.1 with patch 299") |
221 return | 218 return |
222 endif | 219 endif |
223 | 220 |
224 if getline(1) !~ '^" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.$' | 221 if getline(1) !~ '^" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.$' |
336 1 | 333 1 |
337 silent d | 334 silent d |
338 | 335 |
339 " write tab to file | 336 " write tab to file |
340 if a:really | 337 if a:really |
341 let fnamepath= s:Path(home."/".fname,'') | 338 let fnamepath= home."/".fname |
342 " call Decho("exe w! ".fnameescape(fnamepath)) | 339 " call Decho("exe w! ".fnameescape(fnamepath)) |
343 exe "silent w! ".fnameescape(fnamepath) | 340 exe "silent w! ".fnameescape(fnamepath) |
344 echo "wrote ".fnamepath | 341 echo "wrote ".fnamepath |
345 call s:RecordInVar(home,"call delete('".fnameescape(fnamepath)."')") | 342 call s:RecordInVar(home,"call delete('".fnameescape(fnamepath)."')") |
346 endif | 343 endif |
362 endwhile | 359 endwhile |
363 | 360 |
364 " set up help | 361 " set up help |
365 " call Decho("about to set up help: didhelp<".didhelp.">") | 362 " call Decho("about to set up help: didhelp<".didhelp.">") |
366 if didhelp != "" | 363 if didhelp != "" |
367 let htpath= s:Path(home."/".didhelp,"") | 364 let htpath= home."/".didhelp |
368 " call Decho("exe helptags ".htpath) | 365 " call Decho("exe helptags ".htpath) |
369 exe "helptags ".htpath | 366 exe "helptags ".fnameescape(htpath) |
370 echo "did helptags" | 367 echo "did helptags" |
371 endif | 368 endif |
372 | 369 |
373 " make sure a "Press ENTER..." prompt appears to keep the messages showing! | 370 " make sure a "Press ENTER..." prompt appears to keep the messages showing! |
374 while filecnt <= &ch | 371 while filecnt <= &ch |
576 endif | 573 endif |
577 " call Dret("ChgDir : curdir<".getcwd().">") | 574 " call Dret("ChgDir : curdir<".getcwd().">") |
578 endfun | 575 endfun |
579 | 576 |
580 " --------------------------------------------------------------------- | 577 " --------------------------------------------------------------------- |
581 " s:Path: prepend and append quotes and do escaping {{{2 | |
582 fun! s:Path(cmd,quote) | |
583 " call Dfunc("Path(cmd<".a:cmd."> quote<".a:quote.">) vimball_path_escape<".g:vimball_path_escape.">") | |
584 if (has("win32") || has("win95") || has("win64") || has("win16")) | |
585 " let cmdpath= a:quote.substitute(a:cmd,'/','\\','g').a:quote | |
586 let cmdpath= a:quote.substitute(a:cmd,'\\','/','g').a:quote | |
587 " call Decho("cmdpath<".cmdpath."> (win32 mod)") | |
588 else | |
589 let cmdpath= a:quote.a:cmd.a:quote | |
590 " call Decho("cmdpath<".cmdpath."> (not-win32 mod)") | |
591 endif | |
592 if a:quote == "" && g:vimball_path_escape !~ ' ' | |
593 let cmdpath= escape(cmdpath,' ') | |
594 " call Decho("cmdpath<".cmdpath."> (empty quote case)") | |
595 endif | |
596 let cmdpath= escape(cmdpath,g:vimball_path_escape) | |
597 " call Dret("Path <".cmdpath.">") | |
598 return cmdpath | |
599 endfun | |
600 | |
601 " --------------------------------------------------------------------- | |
602 " s:RecordInVar: record a un-vimball command in the .VimballRecord file {{{2 | 578 " s:RecordInVar: record a un-vimball command in the .VimballRecord file {{{2 |
603 fun! s:RecordInVar(home,cmd) | 579 fun! s:RecordInVar(home,cmd) |
604 " call Dfunc("RecordInVar(home<".a:home."> cmd<".a:cmd.">)") | 580 " call Dfunc("RecordInVar(home<".a:home."> cmd<".a:cmd.">)") |
605 if a:cmd =~ '^rmdir' | 581 if a:cmd =~ '^rmdir' |
606 " if !exists("s:recorddir") | 582 " if !exists("s:recorddir") |
717 let s:regakeep= @a | 693 let s:regakeep= @a |
718 if exists("&acd") | 694 if exists("&acd") |
719 let s:acdkeep = &acd | 695 let s:acdkeep = &acd |
720 endif | 696 endif |
721 let s:eikeep = &ei | 697 let s:eikeep = &ei |
722 let s:fenkeep = &fen | 698 let s:fenkeep = &l:fen |
723 let s:hidkeep = &hidden | 699 let s:hidkeep = &hidden |
724 let s:ickeep = &ic | 700 let s:ickeep = &ic |
725 let s:lzkeep = &lz | 701 let s:lzkeep = &lz |
726 let s:pmkeep = &pm | 702 let s:pmkeep = &pm |
727 let s:repkeep = &report | 703 let s:repkeep = &report |
728 let s:vekeep = &ve | 704 let s:vekeep = &ve |
729 let s:ffkeep = &ff | 705 let s:ffkeep = &l:ff |
730 if exists("&acd") | 706 if exists("&acd") |
731 setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix | 707 setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix |
732 else | 708 else |
733 setlocal ei=all ve=all nofen noic report=999 nohid bt= ma lz pm= ff=unix | 709 setlocal ei=all ve=all nofen noic report=999 nohid bt= ma lz pm= ff=unix |
734 endif | 710 endif |
743 " call Dfunc("RestoreSettings()") | 719 " call Dfunc("RestoreSettings()") |
744 let @a = s:regakeep | 720 let @a = s:regakeep |
745 if exists("&acd") | 721 if exists("&acd") |
746 let &acd = s:acdkeep | 722 let &acd = s:acdkeep |
747 endif | 723 endif |
748 let &fen = s:fenkeep | 724 let &l:fen = s:fenkeep |
749 let &hidden = s:hidkeep | 725 let &hidden = s:hidkeep |
750 let &ic = s:ickeep | 726 let &ic = s:ickeep |
751 let &lz = s:lzkeep | 727 let &lz = s:lzkeep |
752 let &pm = s:pmkeep | 728 let &pm = s:pmkeep |
753 let &report = s:repkeep | 729 let &report = s:repkeep |
754 let &ve = s:vekeep | 730 let &ve = s:vekeep |
755 let &ei = s:eikeep | 731 let &ei = s:eikeep |
756 let &ff = s:ffkeep | 732 let &l:ff = s:ffkeep |
757 if s:makeep[0] != 0 | 733 if s:makeep[0] != 0 |
758 " restore mark a | 734 " restore mark a |
759 " call Decho("restore mark-a: makeep=".string(makeep)) | 735 " call Decho("restore mark-a: makeep=".string(makeep)) |
760 call setpos("'a",s:makeep) | 736 call setpos("'a",s:makeep) |
761 endif | 737 endif |