Bram Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 1 | " zipPlugin.vim: Handles browsing zipfiles |
| 2 | " PLUGIN PORTION |
Bram Moolenaar | 71badf9 | 2023-04-22 22:40:14 +0100 | [diff] [blame] | 3 | " Date: Dec 07, 2021 |
Christian Brabandt | f9ca139 | 2024-02-19 20:37:11 +0100 | [diff] [blame] | 4 | " Maintainer: This runtime file is looking for a new maintainer. |
| 5 | " Former Maintainer: Charles E Campbell |
Christian Brabandt | a359c9c | 2025-04-02 20:42:58 +0200 | [diff] [blame] | 6 | " Last Change: |
| 7 | " 2025 Apr 02 by Vim Project: add *.whl to list of zip extensions (#17038) |
Bram Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 8 | " License: Vim License (see vim's :help license) |
Bram Moolenaar | d079690 | 2016-09-16 20:02:31 +0200 | [diff] [blame] | 9 | " Copyright: Copyright (C) 2005-2016 Charles E. Campbell {{{1 |
Bram Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 10 | " 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 Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 18 | " |
| 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 Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 21 | " --------------------------------------------------------------------- |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 22 | " Load Once: {{{1 |
| 23 | if &cp || exists("g:loaded_zipPlugin") |
| 24 | finish |
| 25 | endif |
Bram Moolenaar | 71badf9 | 2023-04-22 22:40:14 +0100 | [diff] [blame] | 26 | let g:loaded_zipPlugin = "v33" |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 27 | let s:keepcpo = &cpo |
Bram Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 28 | set cpo&vim |
| 29 | |
| 30 | " --------------------------------------------------------------------- |
Bram Moolenaar | 94f76b7 | 2013-07-04 22:50:40 +0200 | [diff] [blame] | 31 | " Options: {{{1 |
| 32 | if !exists("g:zipPlugin_ext") |
Christian Brabandt | a359c9c | 2025-04-02 20:42:58 +0200 | [diff] [blame] | 33 | 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 Moolenaar | 94f76b7 | 2013-07-04 22:50:40 +0200 | [diff] [blame] | 34 | endif |
| 35 | |
| 36 | " --------------------------------------------------------------------- |
Bram Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 37 | " Public Interface: {{{1 |
| 38 | augroup zip |
| 39 | au! |
Bram Moolenaar | a5792f5 | 2005-11-23 21:25:05 +0000 | [diff] [blame] | 40 | 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 Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 44 | |
| 45 | if has("unix") |
Bram Moolenaar | a5792f5 | 2005-11-23 21:25:05 +0000 | [diff] [blame] | 46 | 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 Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 50 | endif |
| 51 | |
Bram Moolenaar | 94f76b7 | 2013-07-04 22:50:40 +0200 | [diff] [blame] | 52 | exe "au BufReadCmd ".g:zipPlugin_ext.' call zip#Browse(expand("<amatch>"))' |
Bram Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 53 | augroup END |
| 54 | |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 55 | " --------------------------------------------------------------------- |
| 56 | " Restoration And Modelines: {{{1 |
| 57 | " vim: fdm=marker |
Bram Moolenaar | 6b730e1 | 2005-09-16 21:47:57 +0000 | [diff] [blame] | 58 | let &cpo= s:keepcpo |
| 59 | unlet s:keepcpo |