aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/tar.vim
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
commit931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch)
treed8c1843a95da5ea0bb4acc09f7e37843d9995c86 /runtime/autoload/tar.vim
parent142d9041391780ac15b89886a54015fdc5c73995 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-userreg.tar.gz
rneovim-userreg.tar.bz2
rneovim-userreg.zip
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'runtime/autoload/tar.vim')
-rw-r--r--runtime/autoload/tar.vim112
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