blob: 2d12e65ec1ab576b2d2640a26a505b2c6da09ae0 [file] [log] [blame]
Bram Moolenaar6b730e12005-09-16 21:47:57 +00001" zipPlugin.vim: Handles browsing zipfiles
2" PLUGIN PORTION
Bram Moolenaar71badf92023-04-22 22:40:14 +01003" Date: Dec 07, 2021
Christian Brabandtf9ca1392024-02-19 20:37:11 +01004" Maintainer: This runtime file is looking for a new maintainer.
5" Former Maintainer: Charles E Campbell
Christian Brabandta359c9c2025-04-02 20:42:58 +02006" Last Change:
7" 2025 Apr 02 by Vim Project: add *.whl to list of zip extensions (#17038)
Bram Moolenaar6b730e12005-09-16 21:47:57 +00008" License: Vim License (see vim's :help license)
Bram Moolenaard0796902016-09-16 20:02:31 +02009" Copyright: Copyright (C) 2005-2016 Charles E. Campbell {{{1
Bram Moolenaar6b730e12005-09-16 21:47:57 +000010" Permission is hereby granted to use and distribute this code,
11" with or without modifications, provided that this copyright
12" notice is copied with it. Like anything else that's free,
13" zipPlugin.vim is provided *as is* and comes with no warranty
14" of any kind, either expressed or implied. By using this
15" plugin, you agree that in no event will the copyright
16" holder be liable for any damages resulting from the use
17" of this software.
Bram Moolenaar9964e462007-05-05 17:54:07 +000018"
19" (James 4:8 WEB) Draw near to God, and he will draw near to you.
20" Cleanse your hands, you sinners; and purify your hearts, you double-minded.
Bram Moolenaar6b730e12005-09-16 21:47:57 +000021" ---------------------------------------------------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +000022" Load Once: {{{1
23if &cp || exists("g:loaded_zipPlugin")
24 finish
25endif
Bram Moolenaar71badf92023-04-22 22:40:14 +010026let g:loaded_zipPlugin = "v33"
Bram Moolenaar9964e462007-05-05 17:54:07 +000027let s:keepcpo = &cpo
Bram Moolenaar6b730e12005-09-16 21:47:57 +000028set cpo&vim
29
30" ---------------------------------------------------------------------
Bram Moolenaar94f76b72013-07-04 22:50:40 +020031" Options: {{{1
32if !exists("g:zipPlugin_ext")
Christian Brabandta359c9c2025-04-02 20:42:58 +020033 let g:zipPlugin_ext='*.aar,*.apk,*.celzip,*.crtx,*.docm,*.docx,*.dotm,*.dotx,*.ear,*.epub,*.gcsx,*.glox,*.gqsx,*.ja,*.jar,*.kmz,*.odb,*.odc,*.odf,*.odg,*.odi,*.odm,*.odp,*.ods,*.odt,*.otc,*.otf,*.otg,*.oth,*.oti,*.otp,*.ots,*.ott,*.oxt,*.potm,*.potx,*.ppam,*.ppsm,*.ppsx,*.pptm,*.pptx,*.sldx,*.thmx,*.vdw,*.war,*.whl,*.wsz,*.xap,*.xlam,*.xlsb,*.xlsm,*.xlsx,*.xltm,*.xltx,*.xpi,*.zip'
Bram Moolenaar94f76b72013-07-04 22:50:40 +020034endif
35
36" ---------------------------------------------------------------------
Bram Moolenaar6b730e12005-09-16 21:47:57 +000037" 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 Moolenaar94f76b72013-07-04 22:50:40 +020052 exe "au BufReadCmd ".g:zipPlugin_ext.' 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