summaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2008-08-09 17:55:22 +0000
committerBram Moolenaar <Bram@vim.org>2008-08-09 17:55:22 +0000
commited39e1d53cc4916c2390aea635cd8419497c1460 (patch)
tree55d468c93579ad2607d56eade9fd6b685cd00c44 /runtime/autoload
parenta6404a4e100ebe2081bd2678166604f402330143 (diff)
downloadvim-ed39e1d53cc4916c2390aea635cd8419497c1460.zip
updated for version 7.2-000
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/netrw.vim34
-rw-r--r--runtime/autoload/tar.vim78
2 files changed, 81 insertions, 31 deletions
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 8bd597aaf..1e181d05d 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -1,7 +1,7 @@
" netrw.vim: Handles file transfer and remote directory listing across
" AUTOLOAD SECTION
-" Date: Aug 01, 2008
-" Version: 131
+" Date: Aug 08, 2008
+" Version: 132
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1
@@ -27,7 +27,7 @@ if !exists("s:NOTE")
let s:WARNING = 1
let s:ERROR = 2
endif
-let g:loaded_netrw = "v131"
+let g:loaded_netrw = "v132"
" sanity checks
if v:version < 700
@@ -743,7 +743,12 @@ fun! netrw#NetRead(mode,...)
call netrw#ErrorMsg(s:ERROR,getline(1),4)
let &debug = debugkeep
endif
- call s:SaveBufVars()|bd!|call s:RestoreBufVars()
+ call s:SaveBufVars()
+ bd!
+ if bufname("%") == "" && line("$") == 1 && getline("$") == ""
+ q!
+ endif
+ call s:RestoreBufVars()
let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
let b:netrw_lastfile = choice
@@ -3737,6 +3742,9 @@ endfun
" Creates a marked file match string
" s:netrwmarfilemtch_# -- used with 2match to display marked files
"
+" Creates a buffer version of islocal
+" b:netrw_islocal
+"
fun! s:NetrwMarkFile(islocal,fname)
" call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)")
let curbufnr= bufnr("%")
@@ -3745,15 +3753,16 @@ fun! s:NetrwMarkFile(islocal,fname)
" markfile list exists
" call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">")
" call Decho("starting s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">")
+ let b:netrw_islocal= a:islocal
if index(s:netrwmarkfilelist_{curbufnr},a:fname) == -1
- " append filename to local-directory markfilelist
+ " append filename to buffer's markfilelist
" call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">")
call add(s:netrwmarkfilelist_{curbufnr},a:fname)
let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(a:fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>'
else
- " remove filename from local markfilelist
+ " remove filename from buffer's markfilelist
" call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">")
call filter(s:netrwmarkfilelist_{curbufnr},'v:val != a:fname')
if s:netrwmarkfilelist_{curbufnr} == []
@@ -4760,20 +4769,22 @@ fun! netrw#NetrwObtain(islocal,fname,...)
endif
" call Decho("tgtdir<".tgtdir.">")
- if a:islocal
- " obtain a file from b:netrw_curdir to getcwd()
-" call Decho("obtain a local file from ".b:netrw_curdir." to ".tgtdir
+ if b:netrw_islocal
+ " obtain a file from local b:netrw_curdir to (local) tgtdir
+" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir)
if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
let topath= s:ComposePath(tgtdir,"")
if (has("win32") || has("win95") || has("win64") || has("win16"))
" transfer files one at time
+" call Decho("transfer files one at a time")
for fname in fnamelist
" call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")")
call system(g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath))
endfor
else
" transfer files with one command
- let filelist= join(map(deepcopy(fname),"shellescape(v:val)"))
+" call Decho("transfer files with one command")
+ let filelist= join(map(deepcopy(fnamelist),"shellescape(v:val)"))
" call Decho("system(".g:netrw_localcopycmd." ".filelist." ".shellescape(topath).")")
call system(g:netrw_localcopycmd." ".filelist." ".shellescape(topath))
endif
@@ -4784,7 +4795,8 @@ fun! netrw#NetrwObtain(islocal,fname,...)
endif
else
-" call Decho("obtain a remote file from ".b:netrw_curdir." to ".tgtdir)
+ " obtain files from remote b:netrw_curdir to local tgtdir
+" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir)
if type(a:fname) == 1
call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname)
endif
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index fc168e801..af6fbca2e 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -1,7 +1,7 @@
" tar.vim: Handles browsing tarfiles
" AUTOLOAD PORTION
-" Date: Jul 30, 2008
-" Version: 20
+" Date: Aug 08, 2008
+" Version: 23 + modifications by Bram
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" License: Vim License (see vim's :help license)
"
@@ -24,7 +24,7 @@ set cpo&vim
if &cp || exists("g:loaded_tar") || v:version < 700
finish
endif
-let g:loaded_tar= "v20"
+let g:loaded_tar= "v23b"
"call Decho("loading autoload/tar.vim")
if v:version < 701 || (v:version == 701 && !has("patch299"))
echoerr "(autoload/tar.vim) need vim v7.1 with patchlevel 299"
@@ -134,16 +134,20 @@ fun! tar#Browse(tarfile)
endif
let curlast= line("$")
if tarfile =~# '\.\(gz\|tgz\)$'
-" call Decho("1: exe silent r! gzip -d -c ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
+" call Decho("1: exe silent r! gzip -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "silent r! gzip -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.lrp'
" call Decho("2: exe silent r! cat -- ".s:Escape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "silent r! cat -- ".s:Escape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.bz2$'
-" call Decho("3: exe silent r! bzip2 -d -c ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
+" call Decho("3: exe silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
else
-" call Decho("4: exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".s:Escape(tarfile,0))
+ if tarfile =~ '^\s*-'
+ " A file name starting with a dash may be taken as an option. Prepend ./ to avoid that.
+ let tarfile = substitute(tarfile, '-', './-', '')
+ endif
+" call Decho("4: exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".s:Escape(tarfile,1))
exe "silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".s:Escape(tarfile,1)
endif
if v:shell_error != 0
@@ -183,6 +187,13 @@ fun! s:TarBrowseSelect()
let fname= getline(".")
" call Decho("fname<".fname.">")
+ if !exists("g:tar_secure") && fname =~ '^\s*-\|\s\+-'
+ redraw!
+ echohl WarningMsg | echo '***error*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"; See :help tar-options'
+" call Dret('tar#BrowseSelect : rejecting tarfile member<'.fname.'> because of embedded "-"')
+ return
+ endif
+
" sanity check
if fname =~ '^"'
let &report= repkeep
@@ -239,18 +250,27 @@ fun! tar#Read(fname,mode)
endif
endif
+ if exists("g:tar_secure")
+ let tar_secure= " -- "
+ else
+ let tar_secure= " "
+ endif
if tarfile =~# '\.\(gz\|tgz\)$'
-" call Decho("5: exe silent r! gzip -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.s:Escape(fname,1))
- exe "silent r! gzip -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname,1).decmp
+" call Decho("5: exe silent r! gzip -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.s:Escape(fname,1))
+ exe "silent r! gzip -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp
elseif tarfile =~# '\.lrp$'
-" call Decho("6: exe silent r! cat ".s:Escape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname,1).decmp)
- exe "silent r! cat -- ".s:Escape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname,1).decmp
+" call Decho("6: exe silent r! cat ".s:Escape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp)
+ exe "silent r! cat -- ".s:Escape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp
elseif tarfile =~# '\.bz2$'
-" call Decho("7: exe silent r! bzip2 -d -c ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname,1).decmp)
- exe "silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname,1).decmp
+" call Decho("7: exe silent r! bzip2 -d -c ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp)
+ exe "silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp
else
-" call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions." -- ".s:Escape(tarfile,1)." ".s:Escape(fname,1))
- exe "silent r! ".g:tar_cmd." -".g:tar_readoptions." ".s:Escape(tarfile,1)." -- ".s:Escape(fname,1).decmp
+ if tarfile =~ '^\s*-'
+ " A file name starting with a dash may be taken as an option. Prepend ./ to avoid that.
+ let tarfile = substitute(tarfile, '-', './-', '')
+ endif
+" call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions." "s:Escape(tarfile,1).tar_secure..s:Escape(fname,1).decmp)
+ exe "silent r! ".g:tar_cmd." -".g:tar_readoptions." ".s:Escape(tarfile,1).tar_secure.s:Escape(fname,1).decmp
endif
if doro
@@ -276,6 +296,13 @@ fun! tar#Write(fname)
let repkeep= &report
set report=10
+ if !exists("g:tar_secure") && a:fname =~ '^\s*-\|\s\+-'
+ redraw!
+ echohl WarningMsg | echo '***error*** (tar#Write) rejecting tarfile member<'.a:fname.'> because of embedded "-"; See :help tar-options'
+" call Dret('tar#Write : rejecting tarfile member<'.fname.'> because of embedded "-"')
+ return
+ endif
+
" sanity checks
if !executable(g:tar_cmd)
redraw!
@@ -331,19 +358,21 @@ fun! tar#Write(fname)
if tarfile =~# '\.gz'
call system("gzip -d -- ".s:Escape(tarfile,0))
let tarfile = substitute(tarfile,'\.gz','','e')
- let compress= "gzip ".s:Escape(tarfile,0)
+ let compress= "gzip -- ".s:Escape(tarfile,0)
+" call Decho("compress<".compress.">")
elseif tarfile =~# '\.tgz'
call system("gzip -d -- ".s:Escape(tarfile,0))
let tarfile = substitute(tarfile,'\.tgz','.tar','e')
let compress= "gzip -- ".s:Escape(tarfile,0)
let tgz = 1
+" call Decho("compress<".compress.">")
elseif tarfile =~# '\.bz2'
call system("bzip2 -d -- ".s:Escape(tarfile,0))
let tarfile = substitute(tarfile,'\.bz2','','e')
let compress= "bzip2 -- ".s:Escape(tarfile,0)
+" call Decho("compress<".compress.">")
endif
" call Decho("tarfile<".tarfile.">")
-" call Decho("compress<".compress.">")
if v:shell_error != 0
redraw!
@@ -363,16 +392,25 @@ fun! tar#Write(fname)
if tarfile !~ '/'
let tarfile= curdir.'/'.tarfile
endif
+ if tarfile =~ '^\s*-'
+ " A file name starting with a dash may be taken as an option. Prepend ./ to avoid that.
+ let tarfile = substitute(tarfile, '-', './-', '')
+ endif
" call Decho("tarfile<".tarfile."> fname<".fname.">")
+ if exists("g:tar_secure")
+ let tar_secure= " -- "
+ else
+ let tar_secure= " "
+ endif
exe "w! ".fnameescape(fname)
if executable("cygpath")
let tarfile = substitute(system("cygpath ".s:Escape(tarfile,0)),'\n','','e')
endif
" delete old file from tarfile
-" call Decho("system(tar --delete -f ".s:Escape(tarfile,0)." -- ".s:Escape(fname,0).")")
- call system("tar --delete -f ".s:Escape(tarfile,0)." -- ".s:Escape(fname,0))
+" call Decho("system(".g:tar_cmd." --delete -f ".s:Escape(tarfile,0)." -- ".s:Escape(fname,0).")")
+ call system(g:tar_cmd." --delete -f ".s:Escape(tarfile,0).tar_secure.s:Escape(fname,0))
if v:shell_error != 0
redraw!
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
@@ -380,8 +418,8 @@ fun! tar#Write(fname)
else
" update tarfile with new file
-" call Decho("tar -".g:tar_writeoptions." ".s:Escape(tarfile,0)." -- ".s:Escape(fname,0))
- call system("tar -".g:tar_writeoptions." ".s:Escape(tarfile,0)." -- ".s:Escape(fname,0))
+" call Decho(g:tar_cmd." -".g:tar_writeoptions." ".s:Escape(tarfile,0).tar_secure.s:Escape(fname,0))
+ call system(g:tar_cmd." -".g:tar_writeoptions." ".s:Escape(tarfile,0).tar_secure.s:Escape(fname,0))
if v:shell_error != 0
redraw!
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None