summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-09 21:46:04 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-09 21:46:04 +0100
commit2963456ff2b740244b3a064785fe681b1998d75e (patch)
tree1f5f9d17eb0cb178f4064d68efc81ec18c1163b8 /runtime
parentac15fd8c6761763c8feedef1a2fbd8309f0a823c (diff)
Update runtime files.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/getscript.vim4
-rw-r--r--runtime/autoload/netrw.vim83
-rw-r--r--runtime/autoload/netrwSettings.vim2
-rw-r--r--runtime/autoload/tar.vim244
-rw-r--r--runtime/autoload/zip.vim33
-rw-r--r--runtime/doc/eval.txt38
-rw-r--r--runtime/doc/insert.txt2
-rw-r--r--runtime/doc/pi_getscript.txt14
-rw-r--r--runtime/doc/pi_logipat.txt12
-rw-r--r--runtime/doc/pi_netrw.txt31
-rw-r--r--runtime/doc/pi_tar.txt111
-rw-r--r--runtime/doc/pi_vimball.txt4
-rw-r--r--runtime/doc/pi_zip.txt15
-rw-r--r--runtime/doc/quickfix.txt2
-rw-r--r--runtime/doc/tags1
-rw-r--r--runtime/doc/terminal.txt6
-rw-r--r--runtime/doc/todo.txt14
-rw-r--r--runtime/doc/uganda.txt2
-rw-r--r--runtime/plugin/getscriptPlugin.vim2
-rw-r--r--runtime/plugin/netrwPlugin.vim6
-rw-r--r--runtime/plugin/tarPlugin.vim4
-rw-r--r--runtime/plugin/zipPlugin.vim8
-rw-r--r--runtime/syntax/2html.vim4
23 files changed, 405 insertions, 237 deletions
diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim
index f64c5f199d..8f854b93a9 100644
--- a/runtime/autoload/getscript.vim
+++ b/runtime/autoload/getscript.vim
@@ -22,7 +22,7 @@ if &cp
endif
if v:version < 702
echohl WarningMsg
- echo "***warning*** this version of getscript needs vim 7.2"
+ echo "***warning*** this version of GetLatestVimScripts needs vim 7.2"
echohl Normal
finish
endif
@@ -236,7 +236,7 @@ fun! getscript#GetLatestVimScripts()
" call Decho("..depscript<".depscript.">")
" found a "GetLatestVimScripts: # #" line in the script;
- " check if it's already in the datafile by searching backwards from llp1,
+ " check if its already in the datafile by searching backwards from llp1,
" the (prior to reading in the plugin script) last line plus one of the GetLatestVimScripts.dat file,
" for the script-id with no wrapping allowed.
let curline = line(".")
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 26c4c92d06..f4cc89e474 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -1,8 +1,8 @@
" netrw.vim: Handles file transfer and remote directory listing across
" AUTOLOAD SECTION
-" Date: Nov 29, 2019
-" Version: 167
-" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
+" Date: Jan 07, 2020
+" Version: 168
+" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
@@ -43,7 +43,7 @@ if exists("s:needspatches")
endfor
endif
-let g:loaded_netrw = "v167"
+let g:loaded_netrw = "v168"
if !exists("s:NOTE")
let s:NOTE = 0
let s:WARNING = 1
@@ -68,7 +68,7 @@ setl cpo&vim
" Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number)
" netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number)
" (this function can optionally take a list of messages)
-" Mar 21, 2017 : max errnum currently is 105
+" Dec 2, 2019 : max errnum currently is 106
fun! netrw#ErrorMsg(level,msg,errnum)
" call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow)
@@ -447,23 +447,9 @@ if !exists("g:netrw_localmovecmd")
let g:netrw_localmovecmd= ""
endif
endif
-if v:version < 704 || (v:version == 704 && !has("patch1107"))
- " 1109 provides for delete(tmpdir,"d") which is what will be used
- if exists("g:netrw_local_rmdir")
- let g:netrw_localrmdir= g:netrw_local_rmdir
- call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86)
- endif
- if has("win32") || has("win95") || has("win64") || has("win16")
- if g:netrw_cygwin
- call s:NetrwInit("g:netrw_localrmdir","rmdir")
- else
- let g:netrw_localrmdir = expand("$COMSPEC")
- let g:netrw_localrmdiropt= " /c rmdir"
- endif
- else
- call s:NetrwInit("g:netrw_localrmdir","rmdir")
- endif
-endif
+" following serves as an example for how to insert a version&patch specific test
+"if v:version < 704 || (v:version == 704 && !has("patch1107"))
+"endif
call s:NetrwInit("g:netrw_liststyle" , s:THINLIST)
" sanity checks
if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST
@@ -5217,8 +5203,8 @@ fun! netrw#BrowseX(fname,remote)
if a:remote == 0 && isdirectory(a:fname)
" if its really just a local directory, then do a "gf" instead
" call Decho("remoteā‰”0 and a:fname<".a:fname."> ".(isdirectory(a:fname)? "is a directory" : "is not a directory"),'~'.expand("<slnum>"))
-" call Decho("..appears to be a local directory; using gf instead",'~'.expand("<slnum>"))
- norm! gf
+" call Decho("..appears to be a local directory; using e ".a:fname." instead",'~'.expand("<slnum>"))
+ exe "e ".a:fname
" call Dret("netrw#BrowseX")
return
elseif a:remote == 1 && a:fname !~ '^https\=:' && a:fname =~ '/$'
@@ -7158,17 +7144,8 @@ fun! s:NetrwMarkFileCopy(islocal,...)
" call Dret("s:NetrwMarkFileCopy : lcd failure")
return
endif
- if v:version < 704 || (v:version == 704 && !has("patch1107"))
- call s:NetrwExe("sil !".g:netrw_localrmdir.g:netrw_localrmdiropt." ".s:ShellEscape(tmpdir,1))
- if v:shell_error != 0
- call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80)
-" " call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) )
- return
- endif
- else
- if delete(tmpdir,"d")
- call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103)
- endif
+ if delete(tmpdir,"d")
+ call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103)
endif
else
if s:NetrwLcd(curdir)
@@ -9587,6 +9564,7 @@ fun! s:NetrwWideListing()
" call Decho("setl ma noro",'~'.expand("<slnum>"))
let b:netrw_cpf= 0
if line("$") >= w:netrw_bannercnt
+ " determine the maximum filename size; use that to set cpf
exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
NetrwKeepj call histdel("/",-1)
else
@@ -9594,6 +9572,7 @@ fun! s:NetrwWideListing()
" call Dret("NetrwWideListing")
return
endif
+ " allow for two spaces to separate columns
let b:netrw_cpf= b:netrw_cpf + 2
" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("<slnum>"))
@@ -9621,10 +9600,11 @@ fun! s:NetrwWideListing()
if newcolend > line("$") | let newcolend= line("$") | endif
let newcolqty= newcolend - newcolstart
exe newcolstart
+ " COMBAK: both of the visual-mode using lines below are problematic vis-a-vis @*
if newcolqty == 0
exe "sil! NetrwKeepj norm! 0\<c-v>$h\"ax".w:netrw_bannercnt."G$\"ap"
else
- exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$h\"ax'.w:netrw_bannercnt.'G$\"ap'
+ exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$h"ax'.w:netrw_bannercnt.'G$"ap'
endif
exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _'
exe 'sil! NetrwKeepj '.w:netrw_bannercnt
@@ -11048,9 +11028,10 @@ fun! s:NetrwLocalRename(path) range
" call Dfunc("NetrwLocalRename(path<".a:path.">)")
" preparation for removing multiple files/directories
- let ykeep = @@
- let ctr = a:firstline
- let svpos = winsaveview()
+ let ykeep = @@
+ let ctr = a:firstline
+ let svpos = winsaveview()
+ let all = 0
" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
" rename files given by the markfilelist
@@ -11078,6 +11059,23 @@ fun! s:NetrwLocalRename(path) range
let newname = substitute(oldname,subfrom,subto,'')
endif
endif
+ if !all && filereadable(newname)
+ call inputsave()
+ let response= input("File<".newname."> already exists; do you want to overwrite it? (y/all/n) ")
+ call inputrestore()
+ if response == "all"
+ let all= 1
+ elseif response != "y" && response != "yes"
+ " refresh the directory
+" call Decho("refresh the directory listing",'~'.expand("<slnum>"))
+ NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
+ let @@= ykeep
+" call Dret("NetrwLocalRename")
+ return
+ endif
+ endif
call rename(oldname,newname)
endfor
call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
@@ -11101,14 +11099,14 @@ fun! s:NetrwLocalRename(path) range
NetrwKeepj norm! 0
let oldname= s:ComposePath(a:path,curword)
-" call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
+" call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
call inputsave()
let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
call inputrestore()
call rename(oldname,newname)
-" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>"))
+" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>"))
let ctr= ctr + 1
endwhile
@@ -11896,6 +11894,9 @@ fun! s:NetrwExe(cmd)
" call Decho("exe ".a:cmd,'~'.expand("<slnum>"))
exe a:cmd
endif
+ if v:shell_error
+ call netrw#ErrorMsg(s:WARNING,"shell signalled an error",106)
+ endif
" call Dret("s:NetrwExe : v:shell_error=".v:shell_error)
endfun
diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim
index 327db6a540..bed5cfc455 100644
--- a/runtime/autoload/netrwSettings.vim
+++ b/runtime/autoload/netrwSettings.vim
@@ -1,6 +1,6 @@
" netrwSettings.vim: makes netrw settings simpler
" Date: Nov 09, 2016
-" Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz>
+" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Version: 16
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index dc670dbd14..3ed34fd0aa 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -1,13 +1,13 @@
" tar.vim: Handles browsing tarfiles
" AUTOLOAD PORTION
-" Date: Apr 17, 2013
-" Version: 29
-" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
-" License: Vim License (see vim's :help license)
+" Date: Jan 07, 2020
+" Version: 32
+" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" License: Vim License (see vim's :help license)
"
" Contains many ideas from Michael Toren's <tar.vim>
"
-" Copyright: Copyright (C) 2005-2011 Charles E. Campbell {{{1
+" Copyright: Copyright (C) 2005-2017 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@@ -22,7 +22,7 @@
if &cp || exists("g:loaded_tar")
finish
endif
-let g:loaded_tar= "v29"
+let g:loaded_tar= "v32"
if v:version < 702
echohl WarningMsg
echo "***warning*** this version of tar needs vim 7.2"
@@ -48,6 +48,9 @@ endif
if !exists("g:tar_writeoptions")
let g:tar_writeoptions= "uf"
endif
+if !exists("g:tar_delfile")
+ let g:tar_delfile="--delete -f"
+endif
if !exists("g:netrw_cygwin")
if has("win32") || has("win95") || has("win64") || has("win16")
if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
@@ -109,6 +112,7 @@ fun! tar#Browse(tarfile)
" sanity checks
if !executable(g:tar_cmd)
redraw!
+" call Decho('***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system')
echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
let &report= repkeep
" call Dret("tar#Browse")
@@ -117,8 +121,9 @@ fun! tar#Browse(tarfile)
if !filereadable(a:tarfile)
" call Decho('a:tarfile<'.a:tarfile.'> not filereadable')
if a:tarfile !~# '^\a\+://'
- " if it's an url, don't complain, let url-handlers such as vim do its thing
+ " if its an url, don't complain, let url-handlers such as vim do its thing
redraw!
+" call Decho("***error*** (tar#Browse) File not readable<".a:tarfile.">")
echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None
endif
let &report= repkeep
@@ -152,12 +157,27 @@ fun! tar#Browse(tarfile)
" assuming cygwin
let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
endif
-
let curlast= line("$")
- if tarfile =~# '\.\(gz\|tgz\)$'
- let gzip_command = s:get_gzip_command(tarfile)
+
+ if tarfile =~# '\.\(gz\)$'
" call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
- exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+
+ elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$'
+ if has("unix") && executable("file")
+ let filekind= system("file ".shellescape(tarfile,1)) =~ "bzip2"
+ else
+ let filekind= ""
+ endif
+
+ if filekind =~ "bzip2"
+ exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ elseif filekind =~ "XZ"
+ exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ else
+ exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ endif
+
elseif tarfile =~# '\.lrp'
" call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
@@ -184,7 +204,7 @@ fun! tar#Browse(tarfile)
" call Dret("tar#Browse : a:tarfile<".a:tarfile.">")
return
endif
- if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~ '\c\%(warning\|error\|inappropriate\|unrecognized\)')
+ if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~# '\c\%(warning\|error\|inappropriate\|unrecognized\)')
redraw!
echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None
keepj sil! %d
@@ -197,8 +217,13 @@ fun! tar#Browse(tarfile)
return
endif
+ " set up maps supported for tar
setlocal noma nomod ro
- noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
+ noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
+ noremap <silent> <buffer> x :call tar#Extract()<cr>
+ if &mouse != ""
+ noremap <silent> <buffer> <leftmouse> <leftmouse>:call <SID>TarBrowseSelect()<cr>
+ endif
let &report= repkeep
" call Dret("tar#Browse : b:tarfile<".b:tarfile.">")
@@ -235,7 +260,8 @@ fun! s:TarBrowseSelect()
let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
endif
- new
+ " open a new window (tar#Read will read a file into it)
+ noswapfile new
if !exists("g:tar_nomax") || g:tar_nomax == 0
wincmd _
endif
@@ -267,7 +293,7 @@ fun! tar#Read(fname,mode)
if fname =~ '\.bz2$' && executable("bzcat")
let decmp= "|bzcat"
let doro = 1
- elseif fname =~ '\.gz$' && executable("zcat")
+ elseif fname =~ '\.t\=gz$' && executable("zcat")
let decmp= "|zcat"
let doro = 1
elseif fname =~ '\.lzma$' && executable("lzcat")
@@ -291,20 +317,29 @@ fun! tar#Read(fname,mode)
endif
if tarfile =~# '\.bz2$'
-" call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
- elseif tarfile =~# '\.\(gz\|tgz\)$'
- let gzip_command = s:get_gzip_command(tarfile)
-" call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1))
- exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ elseif tarfile =~# '\.\(gz\)$'
+ exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+
+ elseif tarfile =~# '\(\.tgz\|\.tbz\|\.txz\)'
+ if has("unix") && executable("file")
+ let filekind= system("file ".shellescape(tarfile,1))
+ else
+ let filekind= ""
+ endif
+ if filekind =~ "bzip2"
+ exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ elseif filekind =~ "XZ"
+ exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ else
+ exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ endif
+
elseif tarfile =~# '\.lrp$'
-" call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.lzma$'
-" call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.\(xz\|txz\)$'
-" call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
else
if tarfile =~ '^\s*-'
@@ -348,13 +383,14 @@ fun! tar#Write(fname)
" sanity checks
if !executable(g:tar_cmd)
redraw!
- echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system'
+" call Decho('***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system')
let &report= repkeep
" call Dret("tar#Write")
return
endif
if !exists("*mkdir")
redraw!
+" call Decho("***error*** (tar#Write) sorry, mkdir() doesn't work on your system")
echohl Error | echo "***error*** (tar#Write) sorry, mkdir() doesn't work on your system" | echohl None
let &report= repkeep
" call Dret("tar#Write")
@@ -375,6 +411,7 @@ fun! tar#Write(fname)
exe "cd ".fnameescape(tmpdir)
catch /^Vim\%((\a\+)\)\=:E344/
redraw!
+" call Decho("***error*** (tar#Write) cannot cd to temporary directory")
echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None
let &report= repkeep
" call Dret("tar#Write")
@@ -393,8 +430,6 @@ fun! tar#Write(fname)
let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','')
let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','')
- let gzip_command = s:get_gzip_command(tarfile)
-
" handle compressed archives
if tarfile =~# '\.bz2'
call system("bzip2 -d -- ".shellescape(tarfile,0))
@@ -402,12 +437,12 @@ fun! tar#Write(fname)
let compress= "bzip2 -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">")
elseif tarfile =~# '\.gz'
- call system(gzip_command . " -d -- ".shellescape(tarfile,0))
+ call system("gzip -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.gz','','e')
let compress= "gzip -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">")
elseif tarfile =~# '\.tgz'
- call system(gzip_command . " -d -- ".shellescape(tarfile,0))
+ call system("gzip -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.tgz','.tar','e')
let compress= "gzip -- ".shellescape(tarfile,0)
let tgz = 1
@@ -427,6 +462,7 @@ fun! tar#Write(fname)
if v:shell_error != 0
redraw!
+" call Decho("***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname)
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None
else
@@ -459,10 +495,11 @@ fun! tar#Write(fname)
endif
" delete old file from tarfile
-" call Decho("system(".g:tar_cmd." --delete -f ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")")
- call system(g:tar_cmd." --delete -f ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
+" call Decho("system(".g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")")
+ call system(g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
if v:shell_error != 0
redraw!
+" call Decho("***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname))
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
else
@@ -471,6 +508,7 @@ fun! tar#Write(fname)
call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
if v:shell_error != 0
redraw!
+" call Decho("***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname))
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
elseif exists("compress")
" call Decho("call system(".compress.")")
@@ -486,11 +524,11 @@ fun! tar#Write(fname)
if s:tblfile_{winnr()} =~ '^\a\+://'
" call Decho("handle writing <".tarfile."> across network to <".s:tblfile_{winnr()}.">")
let tblfile= s:tblfile_{winnr()}
- 1split|enew
+ 1split|noswapfile enew
let binkeep= &l:binary
let eikeep = &ei
set binary ei=all
- exe "e! ".fnameescape(tarfile)
+ exe "noswapfile e! ".fnameescape(tarfile)
call netrw#NetWrite(tblfile)
let &ei = eikeep
let &l:binary = binkeep
@@ -524,7 +562,7 @@ fun! tar#Diff(userfname,fname)
" sets up b:tardiff_otherbuf variables so each buffer knows about the other (for closing purposes)
diffthis
wincmd v
- exe "e ".fnameescape(fname)
+ exe "noswapfile e ".fnameescape(fname)
diffthis
else
redraw!
@@ -534,6 +572,119 @@ fun! tar#Diff(userfname,fname)
endfun
" ---------------------------------------------------------------------
+" tar#Extract: extract a file from a (possibly compressed) tar archive {{{2
+fun! tar#Extract()
+" call Dfunc("tar#Extract()")
+
+ let repkeep= &report
+ set report=10
+ let fname= getline(".")
+" call Decho("fname<".fname.">")
+
+ if !exists("g:tar_secure") && fname =~ '^\s*-\|\s\+-'
+ redraw!
+ echohl WarningMsg | echo '***warning*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"'
+" call Dret('tar#BrowseSelect : rejecting tarfile member<'.fname.'> because of embedded "-"')
+ return
+ endif
+
+ " sanity check
+ if fname =~ '^"'
+ let &report= repkeep
+" call Dret("TarBrowseSelect")
+ return
+ endif
+
+ let tarball = expand("%")
+" call Decho("tarball<".tarball.">")
+ let tarbase = substitute(tarball,'\..*$','','')
+" call Decho("tarbase<".tarbase.">")
+
+ let extractcmd= netrw#WinPath(g:tar_extractcmd)
+ if filereadable(tarbase.".tar")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tar ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".tar ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tgz")
+ let extractcmd= substitute(extractcmd,"-","-z","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tgz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tgz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tgz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd."t ".tarbase.".tgz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tar.gz")
+ let extractcmd= substitute(extractcmd,"-","-z","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.gz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tar.gz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.gz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".tar.gz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tbz")
+ let extractcmd= substitute(extractcmd,"-","-j","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tbz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tbz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tbz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd."j ".tarbase.".tbz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tar.bz2")
+ let extractcmd= substitute(extractcmd,"-","-j","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.bz2 ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tar.bz2 ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd."j ".tarbase.".tar.bz2 ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd."j ".tarbase.".tar.bz2 ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".txz")
+ let extractcmd= substitute(extractcmd,"-","-J","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".txz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".txz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+
+ elseif filereadable(tarbase.".tar.xz")
+ let extractcmd= substitute(extractcmd,"-","-J","")
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname))
+ if v:shell_error != 0
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".tar.xz ".fname.": failed!")
+ else
+ echo "***note*** successfully extracted ".fname
+ endif
+ endif
+
+ " restore option
+ let &report= repkeep
+
+" call Dret("tar#Extract")
+endfun
+
+" ---------------------------------------------------------------------
" s:Rmdir: {{{2
fun! s:Rmdir(fname)
" call Dfunc("Rmdir(fname<".a:fname.">)")
@@ -587,10 +738,7 @@ fun! tar#Vimuntar(...)
" if necessary, decompress the tarball; then, extract it
if tartail =~ '\.tgz'
- let gzip_command = s:get_gzip_command(tarfile)
- if executable(gzip_command)
- silent exe "!" . gzip_command . " -d ".shellescape(tartail)
- elseif executable("gunzip")
+ if executable("gunzip")
silent exe "!gunzip ".shellescape(tartail)
elseif executable("gzip")
silent exe "!gzip -d ".shellescape(tartail)
@@ -628,28 +776,6 @@ fun! tar#Vimuntar(...)
" call Dret("tar#Vimuntar")
endfun
-func s:get_gzip_command(file)
- " Try using the "file" command to get the actual compression type, since
- " there is no standard way for the naming: ".tgz", ".tbz", ".txz", etc.
- " If the "file" command doesn't work fall back to just using the file name.
- if a:file =~# 'z$'
- let filetype = system('file ' . a:file)
- if filetype =~ 'bzip2 compressed' && executable('bzip2')
- return 'bzip2'
- endif
- if filetype =~ 'XZ compressed' && executable('xz')
- return 'xz'
- endif
- endif
- if a:file =~# 'bz2$'
- return 'bzip2'
- endif
- if a:file =~# 'xz$'
- return 'xz'
- endif
- return 'gzip'
-endfunc
-
" =====================================================================
" Modelines And Restoration: {{{1
let &cpo= s:keepcpo
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim
index ea086e0882..874f44559c 100644
--- a/runtime/autoload/zip.vim
+++ b/runtime/autoload/zip.vim
@@ -1,10 +1,10 @@
" zip.vim: Handles browsing zipfiles
" AUTOLOAD PORTION
-" Date: Sep 13, 2016
-" Version: 28
-" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
+" Date: Jan 07, 2020
+" Version: 30
+" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" License: Vim License (see vim's :help license)
-" Copyright: Copyright (C) 2005-2013 Charles E. Campbell {{{1
+" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@@ -20,7 +20,7 @@
if &cp || exists("g:loaded_zip")
finish
endif
-let g:loaded_zip= "v28"
+let g:loaded_zip= "v30"
if v:version < 702
echohl WarningMsg
echo "***warning*** this version of zip needs vim 7.2 or later"
@@ -65,14 +65,14 @@ endif
" zip#Browse: {{{2
fun! zip#Browse(zipfile)
" call Dfunc("zip#Browse(zipfile<".a:zipfile.">)")
- " sanity check: ensure that the zipfile has "PK" as its first two letters
+ " sanity check: insure that the zipfile has "PK" as its first two letters
" (zipped files have a leading PK as a "magic cookie")
if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK'
- exe "noautocmd e ".fnameescape(a:zipfile)
+ exe "noswapfile noautocmd noswapfile e ".fnameescape(a:zipfile)
" call Dret("zip#Browse : not a zipfile<".a:zipfile.">")
return
" else " Decho
-" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - it's a zip file")
+" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - its a zip file")
endif
let repkeep= &report
@@ -95,7 +95,7 @@ fun! zip#Browse(zipfile)
endif
if !filereadable(a:zipfile)
if a:zipfile !~# '^\a\+://'
- " if it's an url, don't complain, let url-handlers such as vim do its thing
+ " if its an url, don't complain, let url-handlers such as vim do its thing
redraw!
echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None
" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
@@ -141,8 +141,11 @@ fun! zip#Browse(zipfile)
" Maps associated with zip plugin
setlocal noma nomod ro
- noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr>
- noremap <silent> <buffer> x :call zip#Extract()<cr>
+ noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr>
+ noremap <silent> <buffer> x :call zip#Extract()<cr>
+ if &mouse != ""
+ noremap <silent> <buffer> <leftmouse> <leftmouse>:call <SID>ZipBrowseSelect()<cr>
+ endif
let &report= repkeep
" call Dret("zip#Browse")
@@ -175,17 +178,17 @@ fun! s:ZipBrowseSelect()
" get zipfile to the new-window
let zipfile = b:zipfile
- let curfile= expand("%")
+ let curfile = expand("%")
" call Decho("zipfile<".zipfile.">")
" call Decho("curfile<".curfile.">")
- new
+ noswapfile new
if !exists("g:zip_nomax") || g:zip_nomax == 0
wincmd _
endif
let s:zipfile_{winnr()}= curfile
" call Decho("exe e ".fnameescape("zipfile:".zipfile.'::'.fname))
- exe "e ".fnameescape("zipfile:".zipfile.'::'.fname)
+ exe "noswapfile e ".fnameescape("zipfile:".zipfile.'::'.fname)
filetype detect
let &report= repkeep
@@ -339,7 +342,7 @@ fun! zip#Write(fname)
let binkeep= &binary
let eikeep = &ei
set binary ei=all
- exe "e! ".fnameescape(zipfile)
+ exe "noswapfile e! ".fnameescape(zipfile)
call netrw#NetWrite(net