diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
commit | 1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch) | |
tree | cd08258054db80bb9a11b1061bb091c70b76926a /runtime/autoload/tar.vim | |
parent | eaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-aucmd_textputpost.tar.gz rneovim-aucmd_textputpost.tar.bz2 rneovim-aucmd_textputpost.zip |
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'runtime/autoload/tar.vim')
-rw-r--r-- | runtime/autoload/tar.vim | 112 |
1 files changed, 21 insertions, 91 deletions
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index e495e8262a..e242fe98e3 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -1,7 +1,7 @@ " tar.vim: Handles browsing tarfiles " AUTOLOAD PORTION -" Date: Jan 07, 2020 -" Version: 32 +" Date: Nov 14, 2023 +" Version: 32b (with modifications from the Vim Project) " Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> " License: Vim License (see vim's :help license) " @@ -22,7 +22,7 @@ if &cp || exists("g:loaded_tar") finish endif -let g:loaded_tar= "v32" +let g:loaded_tar= "v32a" if v:version < 702 echohl WarningMsg echo "***warning*** this version of tar needs vim 7.2" @@ -208,18 +208,24 @@ 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\)') - redraw! - echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None - keepj sil! %d - let eikeep= &ei - set ei=BufReadCmd,FileReadCmd - exe "r ".fnameescape(a:tarfile) - let &ei= eikeep - keepj sil! 1d -" call Dret("tar#Browse : a:tarfile<".a:tarfile.">") - return - endif + " + " The following should not be neccessary, since in case of errors the + " previous if statement should have caught the problem (because tar exited + " with a non-zero exit code). + " if line("$") == curlast || ( line("$") == (curlast + 1) && + " \ getline("$") =~# '\c\<\%(warning\|error\|inappropriate\|unrecognized\)\>' && + " \ getline("$") =~ '\s' ) + " redraw! + " echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None + " keepj sil! %d + " let eikeep= &ei + " set ei=BufReadCmd,FileReadCmd + " exe "r ".fnameescape(a:tarfile) + " let &ei= eikeep + " keepj sil! 1d + " call Dret("tar#Browse : a:tarfile<".a:tarfile.">") + " return + " endif " set up maps supported for tar setlocal noma nomod ro @@ -735,82 +741,6 @@ fun! s:Rmdir(fname) " call Dret("Rmdir") endfun -" --------------------------------------------------------------------- -" tar#Vimuntar: installs a tarball in the user's .vim / vimfiles directory {{{2 -fun! tar#Vimuntar(...) -" call Dfunc("tar#Vimuntar() a:0=".a:0." a:1<".(exists("a:1")? a:1 : "-n/a-").">") - let tarball = expand("%") -" call Decho("tarball<".tarball.">") - let tarbase = substitute(tarball,'\..*$','','') -" call Decho("tarbase<".tarbase.">") - let tarhome = expand("%:p") - if has("win32") || has("win95") || has("win64") || has("win16") - let tarhome= substitute(tarhome,'\\','/','g') - endif - let tarhome= substitute(tarhome,'/[^/]*$','','') -" call Decho("tarhome<".tarhome.">") - let tartail = expand("%:t") -" call Decho("tartail<".tartail.">") - let curdir = getcwd() -" call Decho("curdir <".curdir.">") - " set up vimhome - if a:0 > 0 && a:1 != "" - let vimhome= a:1 - else - let vimhome= vimball#VimballHome() - endif -" call Decho("vimhome<".vimhome.">") - -" call Decho("curdir<".curdir."> vimhome<".vimhome.">") - if simplify(curdir) != simplify(vimhome) - " copy (possibly compressed) tarball to .vim/vimfiles -" call Decho(netrw#WinPath(g:tar_copycmd)." ".shellescape(tartail)." ".shellescape(vimhome)) - call system(netrw#WinPath(g:tar_copycmd)." ".shellescape(tartail)." ".shellescape(vimhome)) -" call Decho("exe cd ".fnameescape(vimhome)) - exe "cd ".fnameescape(vimhome) - endif -" call Decho("getcwd<".getcwd().">") - - " if necessary, decompress the tarball; then, extract it - if tartail =~ '\.tgz' - if executable("gunzip") - silent exe "!gunzip ".shellescape(tartail) - elseif executable("gzip") - silent exe "!gzip -d ".shellescape(tartail) - else - echoerr "unable to decompress<".tartail."> on this system" - if simplify(curdir) != simplify(tarhome) - " remove decompressed tarball, restore directory -" call Decho("delete(".tartail.".tar)") - call delete(tartail.".tar") -" call Decho("exe cd ".fnameescape(curdir)) - exe "cd ".fnameescape(curdir) - endif -" call Dret("tar#Vimuntar") - return - endif - else - call vimball#Decompress(tartail,0) - endif - let extractcmd= netrw#WinPath(g:tar_extractcmd) -" call Decho("system(".extractcmd." ".shellescape(tarbase.".tar").")") - call system(extractcmd." ".shellescape(tarbase.".tar")) - - " set up help - if filereadable("doc/".tarbase.".txt") -" call Decho("exe helptags ".getcwd()."/doc") - exe "helptags ".getcwd()."/doc" - endif - - if simplify(tarhome) != simplify(vimhome) - " remove decompressed tarball, restore directory - call delete(vimhome."/".tarbase.".tar") - exe "cd ".fnameescape(curdir) - endif - -" call Dret("tar#Vimuntar") -endfun - " ===================================================================== " Modelines And Restoration: {{{1 let &cpo= s:keepcpo |