Mercurial > vim
comparison runtime/autoload/vimball.vim @ 2034:7bc41231fbc7
Update runtime files.
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Wed, 06 Jan 2010 20:54:52 +0100 |
parents | f4f8014d516e |
children | b9e314fe473f |
comparison
equal
deleted
inserted
replaced
2033:de5a43c5eedc | 2034:7bc41231fbc7 |
---|---|
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: Jul 30, 2008 | 3 " Date: Dec 28, 2009 |
4 " Version: 29 | 4 " Version: 30 |
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-2009 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. |
10 " *** *** Use At-Your-Own-Risk! *** *** | 10 " *** *** Use At-Your-Own-Risk! *** *** |
11 | 11 |
12 " --------------------------------------------------------------------- | 12 " --------------------------------------------------------------------- |
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") |
15 finish | 15 finish |
16 endif | 16 endif |
17 let s:keepcpo = &cpo | 17 let g:loaded_vimball = "v30" |
18 let g:loaded_vimball = "v29" | 18 if v:version < 702 |
19 echohl WarningMsg | |
20 echo "***warning*** this version of vimball needs vim 7.2" | |
21 echohl Normal | |
22 finish | |
23 endif | |
24 let s:keepcpo= &cpo | |
19 set cpo&vim | 25 set cpo&vim |
20 "DechoTabOn | 26 "DechoTabOn |
21 | 27 |
22 " ===================================================================== | 28 " ===================================================================== |
23 " Constants: {{{1 | 29 " Constants: {{{1 |
49 let g:vimball_mkdir= "makedir" | 55 let g:vimball_mkdir= "makedir" |
50 endif | 56 endif |
51 if !exists(g:vimball_mkdir) | 57 if !exists(g:vimball_mkdir) |
52 call vimball#ShowMesg(s:WARNING,"(vimball) g:vimball_mkdir undefined") | 58 call vimball#ShowMesg(s:WARNING,"(vimball) g:vimball_mkdir undefined") |
53 endif | 59 endif |
54 endif | |
55 | |
56 " set up shell quoting character | |
57 if exists("g:vimball_shq") && !exists("g:netrw_shq") | |
58 let g:netrw_shq= g:vimball_shq | |
59 endif | |
60 if !exists("g:netrw_shq") | |
61 if exists("&shq") && &shq != "" | |
62 let g:netrw_shq= &shq | |
63 elseif has("win32") || has("win95") || has("win64") || has("win16") | |
64 if g:netrw_cygwin | |
65 let g:netrw_shq= "'" | |
66 else | |
67 let g:netrw_shq= '"' | |
68 endif | |
69 else | |
70 let g:netrw_shq= "'" | |
71 endif | |
72 " call Decho("g:netrw_shq<".g:netrw_shq.">") | |
73 endif | |
74 | |
75 " set up escape string (used to protect paths) | |
76 if !exists("g:vimball_path_escape") | |
77 let g:vimball_path_escape= ' ;#%' | |
78 endif | 60 endif |
79 endif | 61 endif |
80 | 62 |
81 " ===================================================================== | 63 " ===================================================================== |
82 " Functions: {{{1 | 64 " Functions: {{{1 |
104 endif | 86 endif |
105 if vbname !~ '\.vba$' | 87 if vbname !~ '\.vba$' |
106 let vbname= vbname.'.vba' | 88 let vbname= vbname.'.vba' |
107 endif | 89 endif |
108 " call Decho("vbname<".vbname.">") | 90 " call Decho("vbname<".vbname.">") |
109 if a:1 =~ '[\/]' | 91 if !a:writelevel && a:1 =~ '[\/]' |
110 call vimball#ShowMesg(s:ERROR,"(MkVimball) vimball name<".a:1."> should not include slashes") | 92 call vimball#ShowMesg(s:ERROR,"(MkVimball) vimball name<".a:1."> should not include slashes; use ! to insist") |
111 " call Dret("MkVimball : vimball name<".a:1."> should not include slashes") | 93 " call Dret("MkVimball : vimball name<".a:1."> should not include slashes") |
112 return | 94 return |
113 endif | 95 endif |
114 if !a:writelevel && filereadable(vbname) | 96 if !a:writelevel && filereadable(vbname) |
115 call vimball#ShowMesg(s:ERROR,"(MkVimball) file<".vbname."> exists; use ! to insist") | 97 call vimball#ShowMesg(s:ERROR,"(MkVimball) file<".vbname."> exists; use ! to insist") |
123 if a:0 >= 2 | 105 if a:0 >= 2 |
124 " allow user to specify where to get the files | 106 " allow user to specify where to get the files |
125 let home= expand(a:2) | 107 let home= expand(a:2) |
126 else | 108 else |
127 " use first existing directory from rtp | 109 " use first existing directory from rtp |
128 let home= s:VimballHome() | 110 let home= vimball#VimballHome() |
129 endif | 111 endif |
130 | 112 |
131 " save current directory | 113 " save current directory |
132 let curdir = getcwd() | 114 let curdir = getcwd() |
133 call s:ChgDir(home) | 115 call s:ChgDir(home) |
216 echoerr "your vim is missing the fnameescape() function" | 198 echoerr "your vim is missing the fnameescape() function" |
217 " call Dret("vimball#Vimball : needs 7.1 with patch 299") | 199 " call Dret("vimball#Vimball : needs 7.1 with patch 299") |
218 return | 200 return |
219 endif | 201 endif |
220 | 202 |
221 if getline(1) !~ '^" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.$' | 203 if getline(1) !~ '^" Vimball Archiver' |
222 echoerr "(Vimball) The current file does not appear to be a Vimball!" | 204 echoerr "(Vimball) The current file does not appear to be a Vimball!" |
223 " call Dret("vimball#Vimball") | 205 " call Dret("vimball#Vimball") |
224 return | 206 return |
225 endif | 207 endif |
226 | 208 |
238 | 220 |
239 " go to vim plugin home | 221 " go to vim plugin home |
240 if a:0 > 0 | 222 if a:0 > 0 |
241 let home= expand(a:1) | 223 let home= expand(a:1) |
242 else | 224 else |
243 let home= s:VimballHome() | 225 let home= vimball#VimballHome() |
244 endif | 226 endif |
245 " call Decho("home<".home.">") | 227 " call Decho("home<".home.">") |
246 | 228 |
247 " save current directory and remove older same-named vimball, if any | 229 " save current directory and remove older same-named vimball, if any |
248 let curdir = getcwd() | 230 let curdir = getcwd() |
270 exe "tabn ".curtabnr | 252 exe "tabn ".curtabnr |
271 " call Decho("linenr=".linenr." line$=".line("$")) | 253 " call Decho("linenr=".linenr." line$=".line("$")) |
272 while 1 < linenr && linenr < line("$") | 254 while 1 < linenr && linenr < line("$") |
273 let fname = substitute(getline(linenr),'\t\[\[\[1$','','') | 255 let fname = substitute(getline(linenr),'\t\[\[\[1$','','') |
274 let fname = substitute(fname,'\\','/','g') | 256 let fname = substitute(fname,'\\','/','g') |
275 let fsize = getline(linenr+1)+0 | 257 " let fsize = getline(linenr+1)+0 |
258 let fsize = substitute(getline(linenr+1),'^\(\d\+\).\{-}$','\1','')+0 | |
259 let fenc = substitute(getline(linenr+1),'^\d\+\s*\(\S\+\)$','\1','') | |
276 let filecnt = filecnt + 1 | 260 let filecnt = filecnt + 1 |
277 " call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt) | 261 " call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt) |
278 | 262 |
279 if a:really | 263 if a:really |
280 echomsg "extracted <".fname.">: ".fsize." lines" | 264 echomsg "extracted <".fname.">: ".fsize." lines" |
305 let fnamebuf = substitute(fnamebuf,'^.\{-}/\(.*\)$','\1','') | 289 let fnamebuf = substitute(fnamebuf,'^.\{-}/\(.*\)$','\1','') |
306 " call Decho("dirname<".dirname.">") | 290 " call Decho("dirname<".dirname.">") |
307 if !isdirectory(dirname) | 291 if !isdirectory(dirname) |
308 " call Decho("making <".dirname.">") | 292 " call Decho("making <".dirname.">") |
309 if exists("g:vimball_mkdir") | 293 if exists("g:vimball_mkdir") |
310 call system(g:vimball_mkdir." ".s:Escape(dirname)) | 294 call system(g:vimball_mkdir." ".shellescape(dirname)) |
311 else | 295 else |
312 call mkdir(dirname) | 296 call mkdir(dirname) |
313 endif | 297 endif |
314 call s:RecordInVar(home,"rmdir('".dirname."')") | 298 call s:RecordInVar(home,"rmdir('".dirname."')") |
315 endif | 299 endif |
335 | 319 |
336 " write tab to file | 320 " write tab to file |
337 if a:really | 321 if a:really |
338 let fnamepath= home."/".fname | 322 let fnamepath= home."/".fname |
339 " call Decho("exe w! ".fnameescape(fnamepath)) | 323 " call Decho("exe w! ".fnameescape(fnamepath)) |
340 exe "silent w! ".fnameescape(fnamepath) | 324 if fenc != "" |
341 echo "wrote ".fnamepath | 325 exe "silent w! ++enc=".fnameescape(fenc)." ".fnameescape(fnamepath) |
342 call s:RecordInVar(home,"call delete('".fnameescape(fnamepath)."')") | 326 else |
327 exe "silent w! ".fnameescape(fnamepath) | |
328 endif | |
329 echo "wrote ".fnameescape(fnamepath) | |
330 call s:RecordInVar(home,"call delete('".fnamepath."')") | |
343 endif | 331 endif |
344 | 332 |
345 " return to tab with vimball | 333 " return to tab with vimball |
346 " call Decho("exe tabn ".curtabnr) | 334 " call Decho("exe tabn ".curtabnr) |
347 exe "tabn ".curtabnr | 335 exe "tabn ".curtabnr |
416 let curfile= substitute(curfile,'\.vba','','') | 404 let curfile= substitute(curfile,'\.vba','','') |
417 endif | 405 endif |
418 if a:0 >= 2 | 406 if a:0 >= 2 |
419 let home= expand(a:2) | 407 let home= expand(a:2) |
420 else | 408 else |
421 let home= s:VimballHome() | 409 let home= vimball#VimballHome() |
422 endif | 410 endif |
423 let curdir = getcwd() | 411 let curdir = getcwd() |
424 " call Decho("home <".home.">") | 412 " call Decho("home <".home.">") |
425 " call Decho("curfile<".curfile.">") | 413 " call Decho("curfile<".curfile.">") |
426 " call Decho("curdir <".curdir.">") | 414 " call Decho("curdir <".curdir.">") |
430 " call Decho(".VimballRecord is readable") | 418 " call Decho(".VimballRecord is readable") |
431 " call Decho("curfile<".curfile.">") | 419 " call Decho("curfile<".curfile.">") |
432 keepalt keepjumps 1split | 420 keepalt keepjumps 1split |
433 silent! keepalt keepjumps e .VimballRecord | 421 silent! keepalt keepjumps e .VimballRecord |
434 let keepsrch= @/ | 422 let keepsrch= @/ |
435 " call Decho("search for ^".curfile.".vba:") | 423 " call Decho('search for ^\M'.curfile.'.\m: ') |
436 " call Decho("search for ^".curfile."[-0-9.]*.vba:") | 424 " call Decho('search for ^\M'.curfile.'.\mvba: ') |
437 if search('^'.curfile.": ".'cw') | 425 " call Decho('search for ^\M'.curfile.'\m[-0-9.]*\.vba: ') |
426 if search('^\M'.curfile."\m: ".'cw') | |
438 let foundit= 1 | 427 let foundit= 1 |
439 elseif search('^'.curfile.".vba: ",'cw') | 428 elseif search('^\M'.curfile.".\mvba: ",'cw') |
440 let foundit= 1 | 429 let foundit= 1 |
441 elseif search('^'.curfile.'[-0-9.]*.vba: ','cw') | 430 elseif search('^\M'.curfile.'\m[-0-9.]*\.vba: ','cw') |
442 let foundit= 1 | 431 let foundit= 1 |
443 else | 432 else |
444 let foundit = 0 | 433 let foundit = 0 |
445 endif | 434 endif |
446 if foundit | 435 if foundit |
447 let exestring = substitute(getline("."),'^'.curfile.'\S\{-}\.vba: ','','') | 436 let exestring = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vba: ','','') |
448 let s:VBRstring= substitute(exestring,'call delete(','','g') | 437 let s:VBRstring= substitute(exestring,'call delete(','','g') |
449 let s:VBRstring= substitute(s:VBRstring,"[')]",'','g') | 438 let s:VBRstring= substitute(s:VBRstring,"[')]",'','g') |
450 " call Decho("exe ".exestring) | 439 " call Decho("exe ".exestring) |
451 silent! keepalt keepjumps exe exestring | 440 silent! keepalt keepjumps exe exestring |
452 silent! keepalt keepjumps d | 441 silent! keepalt keepjumps d |
470 " call Dret("vimball#RmVimball") | 459 " call Dret("vimball#RmVimball") |
471 endfun | 460 endfun |
472 | 461 |
473 " --------------------------------------------------------------------- | 462 " --------------------------------------------------------------------- |
474 " vimball#Decompress: attempts to automatically decompress vimballs {{{2 | 463 " vimball#Decompress: attempts to automatically decompress vimballs {{{2 |
475 fun! vimball#Decompress(fname) | 464 fun! vimball#Decompress(fname,...) |
476 " call Dfunc("Decompress(fname<".a:fname.">)") | 465 " call Dfunc("Decompress(fname<".a:fname.">) a:0=".a:0) |
477 | 466 |
478 " decompression: | 467 " decompression: |
479 if expand("%") =~ '.*\.gz' && executable("gunzip") | 468 if expand("%") =~ '.*\.gz' && executable("gunzip") |
480 " handle *.gz with gunzip | 469 " handle *.gz with gunzip |
481 silent exe "!gunzip ".s:Escape(a:fname) | 470 silent exe "!gunzip ".shellescape(a:fname) |
482 if v:shell_error != 0 | 471 if v:shell_error != 0 |
483 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) gunzip may have failed with <".a:fname.">") | 472 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) gunzip may have failed with <".a:fname.">") |
484 endif | 473 endif |
485 let fname= substitute(a:fname,'\.gz$','','') | 474 let fname= substitute(a:fname,'\.gz$','','') |
486 exe "e ".escape(fname,' \') | 475 exe "e ".escape(fname,' \') |
487 call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | 476 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif |
488 | 477 |
489 elseif expand("%") =~ '.*\.gz' && executable("gzip") | 478 elseif expand("%") =~ '.*\.gz' && executable("gzip") |
490 " handle *.gz with gzip -d | 479 " handle *.gz with gzip -d |
491 silent exe "!gzip -d ".s:Escape(a:fname) | 480 silent exe "!gzip -d ".shellescape(a:fname) |
492 if v:shell_error != 0 | 481 if v:shell_error != 0 |
493 call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "gzip -d" may have failed with <'.a:fname.">") | 482 call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "gzip -d" may have failed with <'.a:fname.">") |
494 endif | 483 endif |
495 let fname= substitute(a:fname,'\.gz$','','') | 484 let fname= substitute(a:fname,'\.gz$','','') |
496 exe "e ".escape(fname,' \') | 485 exe "e ".escape(fname,' \') |
497 call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | 486 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif |
498 | 487 |
499 elseif expand("%") =~ '.*\.bz2' && executable("bunzip2") | 488 elseif expand("%") =~ '.*\.bz2' && executable("bunzip2") |
500 " handle *.bz2 with bunzip2 | 489 " handle *.bz2 with bunzip2 |
501 silent exe "!bunzip2 ".s:Escape(a:fname) | 490 silent exe "!bunzip2 ".shellescape(a:fname) |
502 if v:shell_error != 0 | 491 if v:shell_error != 0 |
503 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) bunzip2 may have failed with <".a:fname.">") | 492 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) bunzip2 may have failed with <".a:fname.">") |
504 endif | 493 endif |
505 let fname= substitute(a:fname,'\.bz2$','','') | 494 let fname= substitute(a:fname,'\.bz2$','','') |
506 exe "e ".escape(fname,' \') | 495 exe "e ".escape(fname,' \') |
507 call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | 496 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif |
508 | 497 |
509 elseif expand("%") =~ '.*\.bz2' && executable("bzip2") | 498 elseif expand("%") =~ '.*\.bz2' && executable("bzip2") |
510 " handle *.bz2 with bzip2 -d | 499 " handle *.bz2 with bzip2 -d |
511 silent exe "!bzip2 -d ".s:Escape(a:fname) | 500 silent exe "!bzip2 -d ".shellescape(a:fname) |
512 if v:shell_error != 0 | 501 if v:shell_error != 0 |
513 call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "bzip2 -d" may have failed with <'.a:fname.">") | 502 call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "bzip2 -d" may have failed with <'.a:fname.">") |
514 endif | 503 endif |
515 let fname= substitute(a:fname,'\.bz2$','','') | 504 let fname= substitute(a:fname,'\.bz2$','','') |
516 exe "e ".escape(fname,' \') | 505 exe "e ".escape(fname,' \') |
517 call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | 506 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif |
518 | 507 |
519 elseif expand("%") =~ '.*\.zip' && executable("unzip") | 508 elseif expand("%") =~ '.*\.zip' && executable("unzip") |
520 " handle *.zip with unzip | 509 " handle *.zip with unzip |
521 silent exe "!unzip ".s:Escape(a:fname) | 510 silent exe "!unzip ".shellescape(a:fname) |
522 if v:shell_error != 0 | 511 if v:shell_error != 0 |
523 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) unzip may have failed with <".a:fname.">") | 512 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) unzip may have failed with <".a:fname.">") |
524 endif | 513 endif |
525 let fname= substitute(a:fname,'\.zip$','','') | 514 let fname= substitute(a:fname,'\.zip$','','') |
526 exe "e ".escape(fname,' \') | 515 exe "e ".escape(fname,' \') |
527 call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | 516 if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif |
528 endif | 517 endif |
529 | 518 |
530 set noma bt=nofile fmr=[[[,]]] fdm=marker | 519 if a:0 == 0| setlocal noma bt=nofile fmr=[[[,]]] fdm=marker | endif |
531 | 520 |
532 " call Dret("Decompress") | 521 " call Dret("Decompress") |
533 endfun | 522 endfun |
534 | 523 |
535 " --------------------------------------------------------------------- | 524 " --------------------------------------------------------------------- |
536 " vimball#ShowMesg: {{{2 | 525 " vimball#ShowMesg: {{{2 |
537 fun! vimball#ShowMesg(level,msg) | 526 fun! vimball#ShowMesg(level,msg) |
538 " call Dfunc("vimball#ShowMesg(level=".a:level." msg<".a:msg.">)") | 527 " call Dfunc("vimball#ShowMesg(level=".a:level." msg<".a:msg.">)") |
528 | |
539 let rulerkeep = &ruler | 529 let rulerkeep = &ruler |
540 let showcmdkeep = &showcmd | 530 let showcmdkeep = &showcmd |
541 set noruler noshowcmd | 531 set noruler noshowcmd |
542 redraw! | 532 redraw! |
543 | 533 |
544 if &fo =~ '[ta]' | 534 if &fo =~ '[ta]' |
545 echomsg "***vimball*** " a:msg | 535 echomsg "***vimball*** ".a:msg |
546 else | 536 else |
547 if a:level == s:WARNING || a:level == s:USAGE | 537 if a:level == s:WARNING || a:level == s:USAGE |
548 echohl WarningMsg | 538 echohl WarningMsg |
549 elseif a:level == s:ERROR | 539 elseif a:level == s:ERROR |
550 echohl Error | 540 echohl Error |
551 endif | 541 endif |
552 echomsg "***vimball*** " a:msg | 542 echomsg "***vimball*** ".a:msg |
553 echohl None | 543 echohl None |
554 endif | 544 endif |
555 | 545 |
556 if a:level != s:USAGE | 546 if a:level != s:USAGE |
557 call inputsave()|let ok= input("Press <cr> to continue")|call inputrestore() | 547 call inputsave()|let ok= input("Press <cr> to continue")|call inputrestore() |
644 | 634 |
645 " call Dret("s:RecordInFile") | 635 " call Dret("s:RecordInFile") |
646 endfun | 636 endfun |
647 | 637 |
648 " --------------------------------------------------------------------- | 638 " --------------------------------------------------------------------- |
649 " s:VimballHome: determine/get home directory path (usually from rtp) {{{2 | 639 " vimball#VimballHome: determine/get home directory path (usually from rtp) {{{2 |
650 fun! s:VimballHome() | 640 fun! vimball#VimballHome() |
651 " call Dfunc("VimballHome()") | 641 " call Dfunc("vimball#VimballHome()") |
652 if exists("g:vimball_home") | 642 if exists("g:vimball_home") |
653 let home= g:vimball_home | 643 let home= g:vimball_home |
654 else | 644 else |
655 " go to vim plugin home | 645 " go to vim plugin home |
656 for home in split(&rtp,',') + [''] | 646 for home in split(&rtp,',') + [''] |
672 " insure that the home directory exists | 662 " insure that the home directory exists |
673 " call Decho("picked home<".home.">") | 663 " call Decho("picked home<".home.">") |
674 if !isdirectory(home) | 664 if !isdirectory(home) |
675 if exists("g:vimball_mkdir") | 665 if exists("g:vimball_mkdir") |
676 " call Decho("home<".home."> isn't a directory -- making it now with g:vimball_mkdir<".g:vimball_mkdir.">") | 666 " call Decho("home<".home."> isn't a directory -- making it now with g:vimball_mkdir<".g:vimball_mkdir.">") |
677 " call Decho("system(".g:vimball_mkdir." ".s:Escape(home).")") | 667 " call Decho("system(".g:vimball_mkdir." ".shellescape(home).")") |
678 call system(g:vimball_mkdir." ".s:Escape(home)) | 668 call system(g:vimball_mkdir." ".shellescape(home)) |
679 else | 669 else |
680 " call Decho("home<".home."> isn't a directory -- making it now with mkdir()") | 670 " call Decho("home<".home."> isn't a directory -- making it now with mkdir()") |
681 call mkdir(home) | 671 call mkdir(home) |
682 endif | 672 endif |
683 endif | 673 endif |
684 " call Dret("VimballHome <".home.">") | 674 " call Dret("vimball#VimballHome <".home.">") |
685 return home | 675 return home |
686 endfun | 676 endfun |
687 | 677 |
688 " --------------------------------------------------------------------- | 678 " --------------------------------------------------------------------- |
689 " vimball#SaveSettings: {{{2 | 679 " vimball#SaveSettings: {{{2 |
741 unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep s:ffkeep | 731 unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep s:ffkeep |
742 " call Dret("RestoreSettings") | 732 " call Dret("RestoreSettings") |
743 endfun | 733 endfun |
744 | 734 |
745 " --------------------------------------------------------------------- | 735 " --------------------------------------------------------------------- |
746 " s:Escape: {{{2 | |
747 fun s:Escape(name) | |
748 " shellescape() was added by patch 7.0.111 | |
749 if exists("*shellescape") | |
750 return shellescape(a:name) | |
751 endif | |
752 return g:netrw_shq . a:name . g:netrw_shq | |
753 endfun | |
754 | |
755 " --------------------------------------------------------------------- | |
756 " Restore: | |
757 let &cpo= s:keepcpo | |
758 unlet s:keepcpo | |
759 | |
760 " --------------------------------------------------------------------- | |
761 " Modelines: {{{1 | 736 " Modelines: {{{1 |
762 " vim: fdm=marker | 737 " vim: fdm=marker |