diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-04-24 18:51:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-04-24 18:51:19 +0200 |
commit | ff0341946eabf4dcb616a2bbe7a2e9d69ae46e57 (patch) | |
tree | 0444bd0917a2d95ee299383bce98e78caa19380b /runtime/autoload/tar.vim | |
parent | 7afea82f507c0614a22b27d592adf65f5656c2df (diff) |
Updated runtime files.
Diffstat (limited to 'runtime/autoload/tar.vim')
-rw-r--r-- | runtime/autoload/tar.vim | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index d67212934b..5e76870cce 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -1,13 +1,13 @@ " tar.vim: Handles browsing tarfiles " AUTOLOAD PORTION -" Date: Jan 17, 2012 -" Version: 28 -" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> +" Date: Apr 17, 2013 +" Version: 29 +" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-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, Jr. {{{1 +" Copyright: Copyright (C) 2005-2011 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= "v28" +let g:loaded_tar= "v29" if v:version < 702 echohl WarningMsg echo "***warning*** this version of tar needs vim 7.2" @@ -31,6 +31,7 @@ if v:version < 702 endif let s:keepcpo= &cpo set cpo&vim +"DechoTabOn "call Decho("loading autoload/tar.vim") " --------------------------------------------------------------------- @@ -80,7 +81,7 @@ endif " set up shell quoting character if !exists("g:tar_shq") - if exists("&shq") && &shq != "" + if exists("+shq") && exists("&shq") && &shq != "" let g:tar_shq= &shq elseif has("win32") || has("win95") || has("win64") || has("win16") if exists("g:netrw_cygwin") && g:netrw_cygwin @@ -147,7 +148,7 @@ fun! tar#Browse(tarfile) keepj $ let tarfile= a:tarfile - if has("win32") && executable("cygpath") + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif @@ -227,7 +228,7 @@ fun! s:TarBrowseSelect() " about to make a new window, need to use b:tarfile let tarfile= b:tarfile let curfile= expand("%") - if has("win32") && executable("cygpath") + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif @@ -239,6 +240,8 @@ fun! s:TarBrowseSelect() let s:tblfile_{winnr()}= curfile call tar#Read("tarfile:".tarfile.'::'.fname,1) filetype detect + set nomod + exe 'com! -buffer -nargs=? -complete=file TarDiff :call tar#Diff(<q-args>,"'.fnameescape(fname).'")' let &report= repkeep " call Dret("TarBrowseSelect : s:tblfile_".winnr()."<".s:tblfile_{winnr()}.">") @@ -252,7 +255,7 @@ fun! tar#Read(fname,mode) set report=10 let tarfile = substitute(a:fname,'tarfile:\(.\{-}\)::.*$','\1','') let fname = substitute(a:fname,'tarfile:.\{-}::\(.*\)$','\1','') - if has("win32") && executable("cygpath") + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif @@ -425,7 +428,7 @@ fun! tar#Write(fname) if fname =~ '/' let dirpath = substitute(fname,'/[^/]\+$','','e') - if executable("cygpath") + if has("win32unix") && executable("cygpath") let dirpath = substitute(system("cygpath ".shellescape(dirpath, 0)),'\n','','e') endif call mkdir(dirpath,"p") @@ -445,7 +448,7 @@ fun! tar#Write(fname) let tar_secure= " " endif exe "w! ".fnameescape(fname) - if executable("cygpath") + if has("win32unix") && executable("cygpath") let tarfile = substitute(system("cygpath ".shellescape(tarfile,0)),'\n','','e') endif @@ -501,6 +504,30 @@ fun! tar#Write(fname) endfun " --------------------------------------------------------------------- +" tar#Diff: {{{2 +fun! tar#Diff(userfname,fname) +" call Dfunc("tar#Diff(userfname<".a:userfname."> fname<".a:fname.")") + let fname= a:fname + if a:userfname != "" + let fname= a:userfname + endif + if filereadable(fname) + " sets current file (from tarball) for diff'ing + " splits window vertically + " opens original file, sets it for diff'ing + " sets up b:tardiff_otherbuf variables so each buffer knows about the other (for closing purposes) + diffthis + wincmd v + exe "e ".fnameescape(fname) + diffthis + else + redraw! + echo "***warning*** unable to read file<".fname.">" + endif +" call Dret("tar#Diff") +endfun + +" --------------------------------------------------------------------- " s:Rmdir: {{{2 fun! s:Rmdir(fname) " call Dfunc("Rmdir(fname<".a:fname.">)") |