blob: 01ddd48df0c6a5d68e00834503be3fde0f7a0931 [file] [log] [blame]
Bram Moolenaar58071af2005-09-14 21:41:18 +00001" tarPlugin.vim -- a Vim plugin for browsing tarfiles
Bram Moolenaar83e138c2007-05-05 18:27:07 +00002" Original was copyright (c) 2002, Michael C. Toren <mct@toren.net>
3" Modified by Charles E. Campbell, Jr.
Bram Moolenaar58071af2005-09-14 21:41:18 +00004" Distributed under the GNU General Public License.
5"
6" Updates are available from <http://michael.toren.net/code/>. If you
7" find this script useful, or have suggestions for improvements, please
8" let me know.
9" Also look there for further comments and documentation.
10"
11" This part only sets the autocommands. The functions are in autoload/tar.vim.
Bram Moolenaar83e138c2007-05-05 18:27:07 +000012" ---------------------------------------------------------------------
13" Load Once: {{{1
14if &cp || exists("g:loaded_tarPlugin")
15 finish
16endif
Bram Moolenaar6be7f872012-01-20 21:08:56 +010017let g:loaded_tarPlugin = "v28"
Bram Moolenaar83e138c2007-05-05 18:27:07 +000018let s:keepcpo = &cpo
19set cpo&vim
Bram Moolenaar58071af2005-09-14 21:41:18 +000020
Bram Moolenaar83e138c2007-05-05 18:27:07 +000021" ---------------------------------------------------------------------
22" Public Interface: {{{1
Bram Moolenaara5792f52005-11-23 21:25:05 +000023augroup tar
24 au!
Bram Moolenaar8c8de832008-06-24 22:58:06 +000025 au BufReadCmd tarfile::* call tar#Read(expand("<amatch>"), 1)
26 au FileReadCmd tarfile::* call tar#Read(expand("<amatch>"), 0)
27 au BufWriteCmd tarfile::* call tar#Write(expand("<amatch>"))
28 au FileWriteCmd tarfile::* call tar#Write(expand("<amatch>"))
Bram Moolenaar58071af2005-09-14 21:41:18 +000029
Bram Moolenaara5792f52005-11-23 21:25:05 +000030 if has("unix")
Bram Moolenaar8c8de832008-06-24 22:58:06 +000031 au BufReadCmd tarfile::*/* call tar#Read(expand("<amatch>"), 1)
32 au FileReadCmd tarfile::*/* call tar#Read(expand("<amatch>"), 0)
33 au BufWriteCmd tarfile::*/* call tar#Write(expand("<amatch>"))
34 au FileWriteCmd tarfile::*/* call tar#Write(expand("<amatch>"))
Bram Moolenaara5792f52005-11-23 21:25:05 +000035 endif
Bram Moolenaar58071af2005-09-14 21:41:18 +000036
Bram Moolenaar5c736222010-01-06 20:54:52 +010037 au BufReadCmd *.tar.gz call tar#Browse(expand("<amatch>"))
38 au BufReadCmd *.tar call tar#Browse(expand("<amatch>"))
39 au BufReadCmd *.lrp call tar#Browse(expand("<amatch>"))
40 au BufReadCmd *.tar.bz2 call tar#Browse(expand("<amatch>"))
41 au BufReadCmd *.tar.Z call tar#Browse(expand("<amatch>"))
42 au BufReadCmd *.tgz call tar#Browse(expand("<amatch>"))
43 au BufReadCmd *.tar.lzma call tar#Browse(expand("<amatch>"))
Bram Moolenaar477db062010-07-28 18:17:41 +020044 au BufReadCmd *.tar.xz call tar#Browse(expand("<amatch>"))
45 au BufReadCmd *.txz call tar#Browse(expand("<amatch>"))
Bram Moolenaara5792f52005-11-23 21:25:05 +000046augroup END
Bram Moolenaar5c736222010-01-06 20:54:52 +010047com! -nargs=? -complete=file Vimuntar call tar#Vimuntar(<q-args>)
Bram Moolenaar58071af2005-09-14 21:41:18 +000048
Bram Moolenaar83e138c2007-05-05 18:27:07 +000049" ---------------------------------------------------------------------
50" Restoration And Modelines: {{{1
51" vim: fdm=marker
52let &cpo= s:keepcpo
53unlet s:keepcpo