blob: e198c66e2f3c01ee52a4164f0d3958404b0c7dc6 [file] [log] [blame]
Bram Moolenaar6b730e12005-09-16 21:47:57 +00001" zipPlugin.vim: Handles browsing zipfiles
2" PLUGIN PORTION
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00003" Date: Oct 05, 2007
Bram Moolenaar9964e462007-05-05 17:54:07 +00004" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
Bram Moolenaar6b730e12005-09-16 21:47:57 +00005" License: Vim License (see vim's :help license)
Bram Moolenaar9964e462007-05-05 17:54:07 +00006" Copyright: Copyright (C) 2005,2006 Charles E. Campbell, Jr. {{{1
Bram Moolenaar6b730e12005-09-16 21:47:57 +00007" Permission is hereby granted to use and distribute this code,
8" with or without modifications, provided that this copyright
9" notice is copied with it. Like anything else that's free,
10" zipPlugin.vim is provided *as is* and comes with no warranty
11" of any kind, either expressed or implied. By using this
12" plugin, you agree that in no event will the copyright
13" holder be liable for any damages resulting from the use
14" of this software.
Bram Moolenaar9964e462007-05-05 17:54:07 +000015"
16" (James 4:8 WEB) Draw near to God, and he will draw near to you.
17" Cleanse your hands, you sinners; and purify your hearts, you double-minded.
Bram Moolenaar6b730e12005-09-16 21:47:57 +000018" ---------------------------------------------------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +000019" Load Once: {{{1
20if &cp || exists("g:loaded_zipPlugin")
21 finish
22endif
Bram Moolenaarc236c162008-07-13 17:41:49 +000023
24" Don't use the plugin if fnameescape() is not available
25if !exists("*fnameescape")
26 if &verbose > 1
27 echoerr "zipPlugin not loaded because fnameescape() is not available"
28 endif
29 finish
30endif
31
32let g:loaded_zipPlugin = "v21+b"
Bram Moolenaar9964e462007-05-05 17:54:07 +000033let s:keepcpo = &cpo
Bram Moolenaar6b730e12005-09-16 21:47:57 +000034set cpo&vim
35
36" ---------------------------------------------------------------------
37" Public Interface: {{{1
38augroup zip
39 au!
Bram Moolenaara5792f52005-11-23 21:25:05 +000040 au BufReadCmd zipfile:* call zip#Read(expand("<amatch>"), 1)
41 au FileReadCmd zipfile:* call zip#Read(expand("<amatch>"), 0)
42 au BufWriteCmd zipfile:* call zip#Write(expand("<amatch>"))
43 au FileWriteCmd zipfile:* call zip#Write(expand("<amatch>"))
Bram Moolenaar6b730e12005-09-16 21:47:57 +000044
45 if has("unix")
Bram Moolenaara5792f52005-11-23 21:25:05 +000046 au BufReadCmd zipfile:*/* call zip#Read(expand("<amatch>"), 1)
47 au FileReadCmd zipfile:*/* call zip#Read(expand("<amatch>"), 0)
48 au BufWriteCmd zipfile:*/* call zip#Write(expand("<amatch>"))
49 au FileWriteCmd zipfile:*/* call zip#Write(expand("<amatch>"))
Bram Moolenaar6b730e12005-09-16 21:47:57 +000050 endif
51
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000052 au BufReadCmd *.zip,*.jar,*.xpi,*.war,*.ear call zip#Browse(expand("<amatch>"))
Bram Moolenaar6b730e12005-09-16 21:47:57 +000053augroup END
54
Bram Moolenaar9964e462007-05-05 17:54:07 +000055" ---------------------------------------------------------------------
56" Restoration And Modelines: {{{1
57" vim: fdm=marker
Bram Moolenaar6b730e12005-09-16 21:47:57 +000058let &cpo= s:keepcpo
59unlet s:keepcpo