|
1 | 1 | " vimball.vim : construct a file containing both paths and files |
2 | 2 | " Author: Charles E. Campbell, Jr. |
3 | | -" Date: Apr 02, 2011 |
4 | | -" Version: 33 |
| 3 | +" Date: Sep 26, 2011 |
| 4 | +" Version: 34 |
5 | 5 | " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim |
6 | 6 | " Copyright: (c) 2004-2011 by Charles E. Campbell, Jr. |
7 | 7 | " The VIM LICENSE applies to Vimball.vim, and Vimball.txt |
|
14 | 14 | if &cp || exists("g:loaded_vimball") |
15 | 15 | finish |
16 | 16 | endif |
17 | | -let g:loaded_vimball = "v33" |
| 17 | +let g:loaded_vimball = "v34" |
18 | 18 | if v:version < 702 |
19 | 19 | echohl WarningMsg |
20 | 20 | echo "***warning*** this version of vimball needs vim 7.2" |
@@ -220,7 +220,16 @@ fun! vimball#Vimball(really,...) |
220 | 220 |
|
221 | 221 | " go to vim plugin home |
222 | 222 | if a:0 > 0 |
| 223 | + " let user specify the directory where the vimball is to be unpacked. |
| 224 | + " If, however, the user did not specify a full path, set the home to be below the current directory |
223 | 225 | let home= expand(a:1) |
| 226 | + if has("win32") || has("win95") || has("win64") || has("win16") |
| 227 | + if home !~ '^\a:[/\\]' |
| 228 | + let home= getcwd().'/'.a:1 |
| 229 | + endif |
| 230 | + elseif home !~ '^/' |
| 231 | + let home= getcwd().'/'.a:1 |
| 232 | + endif |
224 | 233 | else |
225 | 234 | let home= vimball#VimballHome() |
226 | 235 | endif |
@@ -282,11 +291,14 @@ fun! vimball#Vimball(really,...) |
282 | 291 | " call Decho("making directories if they don't exist yet (fname<".fname.">)") |
283 | 292 | let fnamebuf= substitute(fname,'\\','/','g') |
284 | 293 | let dirpath = substitute(home,'\\','/','g') |
| 294 | +" call Decho("init: fnamebuf<".fnamebuf.">") |
| 295 | +" call Decho("init: dirpath <".dirpath.">") |
285 | 296 | while fnamebuf =~ '/' |
286 | 297 | let dirname = dirpath."/".substitute(fnamebuf,'/.*$','','') |
287 | 298 | let dirpath = dirname |
288 | 299 | let fnamebuf = substitute(fnamebuf,'^.\{-}/\(.*\)$','\1','') |
289 | 300 | " call Decho("dirname<".dirname.">") |
| 301 | +" call Decho("dirpath<".dirpath.">") |
290 | 302 | if !isdirectory(dirname) |
291 | 303 | " call Decho("making <".dirname.">") |
292 | 304 | if exists("g:vimball_mkdir") |
@@ -569,9 +581,19 @@ endfun |
569 | 581 | fun! s:ChgDir(newdir) |
570 | 582 | " call Dfunc("ChgDir(newdir<".a:newdir.">)") |
571 | 583 | if (has("win32") || has("win95") || has("win64") || has("win16")) |
572 | | - exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g')) |
| 584 | + try |
| 585 | + exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g')) |
| 586 | + catch /^Vim\%((\a\+)\)\=:E/ |
| 587 | + call mkdir(fnameescape(substitute(a:newdir,'/','\\','g'))) |
| 588 | + exe 'silent cd '.fnameescape(substitute(a:newdir,'/','\\','g')) |
| 589 | + endtry |
573 | 590 | else |
574 | | - exe 'silent cd '.fnameescape(a:newdir) |
| 591 | + try |
| 592 | + exe 'silent cd '.fnameescape(a:newdir) |
| 593 | + catch /^Vim\%((\a\+)\)\=:E/ |
| 594 | + call mkdir(fnameescape(a:newdir)) |
| 595 | + exe 'silent cd '.fnameescape(a:newdir) |
| 596 | + endtry |
575 | 597 | endif |
576 | 598 | " call Dret("ChgDir : curdir<".getcwd().">") |
577 | 599 | endfun |
|
0 commit comments