blob: 2f9fe1eff2a8501a53a646d9c43324a772dfa0d4 [file] [log] [blame]
Bram Moolenaar29634562020-01-09 21:46:04 +01001*pi_zip.txt* For Vim version 8.2. Last change: 2020 Jan 07
Bram Moolenaarc01140a2006-03-24 22:21:52 +00002
Bram Moolenaar910f66f2006-04-05 20:41:53 +00003 +====================+
4 | Zip File Interface |
5 +====================+
Bram Moolenaar98358622005-11-28 22:58:23 +00006
Bram Moolenaar29634562020-01-09 21:46:04 +01007Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
Bram Moolenaar98358622005-11-28 22:58:23 +00008 (remove NOSPAM from Campbell's email first)
Bram Moolenaard0796902016-09-16 20:02:31 +02009Copyright: Copyright (C) 2005-2015 Charles E Campbell *zip-copyright*
Bram Moolenaar6be7f872012-01-20 21:08:56 +010010 The VIM LICENSE (see |copyright|) applies to the files in this
11 package, including zipPlugin.vim, zip.vim, and pi_zip.vim. except use
12 "zip.vim" instead of "VIM". Like anything else that's free, zip.vim
13 and its associated files are provided *as is* and comes with no
14 warranty of any kind, either expressed or implied. No guarantees of
15 merchantability. No guarantees of suitability for any purpose. By
16 using this plugin, you agree that in no event will the copyright
17 holder be liable for any damages resulting from the use of this
18 software. Use at your own risk!
Bram Moolenaar98358622005-11-28 22:58:23 +000019
20==============================================================================
Bram Moolenaar251e1912011-06-19 05:09:16 +0200211. Contents *zip* *zip-contents*
Bram Moolenaar7263a772007-05-10 17:35:54 +000022 1. Contents................................................|zip-contents|
23 2. Usage...................................................|zip-usage|
24 3. Additional Extensions...................................|zip-extension|
25 4. History.................................................|zip-history|
Bram Moolenaar98358622005-11-28 22:58:23 +000026
27==============================================================================
Bram Moolenaar251e1912011-06-19 05:09:16 +0200282. Usage *zip-usage* *zip-manual*
Bram Moolenaar98358622005-11-28 22:58:23 +000029
30 When one edits a *.zip file, this plugin will handle displaying a
31 contents page. Select a file to edit by moving the cursor atop
32 the desired file, then hit the <return> key. After editing, one may
33 also write to the file. Currently, one may not make a new file in
34 zip archives via the plugin.
35
Bram Moolenaar29634562020-01-09 21:46:04 +010036 COMMANDS~
Bram Moolenaard0796902016-09-16 20:02:31 +020037 *zip-x*
Bram Moolenaar29634562020-01-09 21:46:04 +010038 x : extract a listed file when the cursor is atop it
Bram Moolenaard0796902016-09-16 20:02:31 +020039
Bram Moolenaar29634562020-01-09 21:46:04 +010040 OPTIONS~
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000041
42 *g:zip_nomax*
43
44 If this variable exists and is true, the file window will not be
45 automatically maximized when opened.
46
47 *g:zip_shq*
Bram Moolenaar7263a772007-05-10 17:35:54 +000048 Different operating systems may use one or more shells to execute
49 commands. Zip will try to guess the correct quoting mechanism to
50 allow spaces and whatnot in filenames; however, if it is incorrectly
51 guessing the quote to use for your setup, you may use >
52 g:zip_shq
Bram Moolenaar9964e462007-05-05 17:54:07 +000053< which by default is a single quote under Unix (') and a double quote
54 under Windows ("). If you'd rather have no quotes, simply set
55 g:zip_shq to the empty string (let g:zip_shq= "") in your <.vimrc>.
56
Bram Moolenaar7263a772007-05-10 17:35:54 +000057 *g:zip_unzipcmd*
58 Use this option to specify the program which does the duty of "unzip".
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000059 It's used during browsing. By default: >
Bram Moolenaar7263a772007-05-10 17:35:54 +000060 let g:zip_unzipcmd= "unzip"
61<
62 *g:zip_zipcmd*
63 Use this option to specify the program which does the duty of "zip".
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000064 It's used during the writing (updating) of a file already in a zip
Bram Moolenaar7263a772007-05-10 17:35:54 +000065 file; by default: >
66 let g:zip_zipcmd= "zip"
67<
Bram Moolenaard0796902016-09-16 20:02:31 +020068 *g:zip_extractcmd*
69 This option specifies the program (and any options needed) used to
70 extract a file from a zip archive. By default, >
71 let g:zip_extractcmd= g:zip_unzipcmd
72<
Bram Moolenaar00a927d2010-05-14 23:24:24 +020073 PREVENTING LOADING~
74
75 If for some reason you do not wish to use vim to examine zipped files,
76 you may put the following two variables into your <.vimrc> to prevent
Bram Moolenaar24ea3ba2010-09-19 19:01:21 +020077 the zip plugin from loading: >
Bram Moolenaar00a927d2010-05-14 23:24:24 +020078
79 let g:loaded_zipPlugin= 1
80 let g:loaded_zip = 1
81<
Bram Moolenaar7263a772007-05-10 17:35:54 +000082
Bram Moolenaar98358622005-11-28 22:58:23 +000083==============================================================================
Bram Moolenaar7263a772007-05-10 17:35:54 +0000843. Additional Extensions *zip-extension*
85
Bram Moolenaar6be7f872012-01-20 21:08:56 +010086 Apparently there are a number of archivers which generate zip files that
Bram Moolenaar7263a772007-05-10 17:35:54 +000087 don't use the .zip extension (.jar, .xpi, etc). To handle such files,
88 place a line in your <.vimrc> file: >
89
90 au BufReadCmd *.jar,*.xpi call zip#Browse(expand("<amatch>"))
91<
Bram Moolenaarc236c162008-07-13 17:41:49 +000092 One can simply extend this line to accommodate additional extensions that
Bram Moolenaar3577c6f2008-06-24 21:16:56 +000093 should be treated as zip files.
Bram Moolenaar7263a772007-05-10 17:35:54 +000094
Bram Moolenaard0796902016-09-16 20:02:31 +020095 Alternatively, one may change *g:zipPlugin_ext* in one's .vimrc.
96 Currently (11/30/15) it holds: >
97
98 let g:zipPlugin_ext= '*.zip,*.jar,*.xpi,*.ja,*.war,*.ear,*.celzip,
99 \ *.oxt,*.kmz,*.wsz,*.xap,*.docx,*.docm,*.dotx,*.dotm,*.potx,*.potm,
100 \ *.ppsx,*.ppsm,*.pptx,*.pptm,*.ppam,*.sldx,*.thmx,*.xlam,*.xlsx,*.xlsm,
101 \ *.xlsb,*.xltx,*.xltm,*.xlam,*.crtx,*.vdw,*.glox,*.gcsx,*.gqsx,*.epub'
102
Bram Moolenaar7263a772007-05-10 17:35:54 +0000103==============================================================================
Bram Moolenaar251e1912011-06-19 05:09:16 +02001044. History *zip-history* {{{1
Bram Moolenaar29634562020-01-09 21:46:04 +0100105 v29 Apr 02, 2017 * (Klartext) reported that an encrypted zip file could
106 opened but the swapfile held unencrypted contents.
107 The solution is to edit the contents of a zip file
108 using the |:noswapfile| modifier.
Bram Moolenaard0796902016-09-16 20:02:31 +0200109 v28 Oct 08, 2014 * changed the sanity checks for executables to reflect
110 the command actually to be attempted in zip#Read()
111 and zip#Write()
112 * added the extraction of a file capability
113 Nov 30, 2015 * added *.epub to the |g:zipPlugin_ext| list
114 Sep 13, 2016 * added *.apk to the |g:zipPlugin_ext| list and
115 sorted the suffices.
116 v27 Jul 02, 2013 * sanity check: zipfile must have "PK" as its first
117 two bytes.
118 * modified to allow zipfile: entries in quickfix lists
Bram Moolenaarff034192013-04-24 18:51:19 +0200119 v26 Nov 15, 2012 * (Jason Spiro) provided a lot of new extensions that
120 are synonyms for .zip
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100121 v25 Jun 27, 2011 * using keepj with unzip -Z
122 (consistent with the -p variant)
Bram Moolenaarff034192013-04-24 18:51:19 +0200123 * (Ben Staniford) now uses
124 has("win32unix") && executable("cygpath")
125 before converting to cygwin-style paths
Bram Moolenaar251e1912011-06-19 05:09:16 +0200126 v24 Jun 21, 2010 * (Cédric Bosdonnat) unzip seems to need its filenames
127 fnameescape'd as well as shellquote'd
128 * (Motoya Kurotsu) inserted keepj before 0d to protect
129 jump list
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000130 v17 May 09, 2008 * arno caught a security bug
131 v15 Sep 07, 2007 * &shq now used if not the empty string for g:zip_shq
Bram Moolenaar7263a772007-05-10 17:35:54 +0000132 v14 May 07, 2007 * using b:zipfile instead of w:zipfile to avoid problem
133 when editing alternate file to bring up a zipfile
Bram Moolenaar9964e462007-05-05 17:54:07 +0000134 v10 May 02, 2006 * now using "redraw then echo" to show messages, instead
135 of "echo and prompt user"
136 * g:zip_shq provided to allow for quoting control for the
137 command being passed via :r! ... commands.
Bram Moolenaar4c3f5362006-04-11 21:38:50 +0000138 v8 Apr 10, 2006 * Bram Moolenaar reported that he received an error message
Bram Moolenaar9964e462007-05-05 17:54:07 +0000139 due to "Pattern not found: ^.*\%0c"; this was caused by
Bram Moolenaar4c3f5362006-04-11 21:38:50 +0000140 stridx finding a Name... at the beginning of the line;
141 zip.vim tried 4,$s/^.*\%0c//, but that doesn't work.
142 Fixed.
Bram Moolenaar7b5f8322006-03-23 22:47:08 +0000143 v7 Mar 22, 2006 * escaped some characters that can cause filename handling
Bram Moolenaar9964e462007-05-05 17:54:07 +0000144 problems.
Bram Moolenaar86e01082005-12-29 22:45:34 +0000145 v6 Dec 21, 2005 * writing to files not in directories caused problems -
Bram Moolenaar9964e462007-05-05 17:54:07 +0000146 fixed (pointed out by Christian Robinson)
Bram Moolenaar98358622005-11-28 22:58:23 +0000147 v5 Nov 22, 2005 * report option workaround installed
148 v3 Oct 18, 2005 * <amatch> used instead of <afile> in autocmds
149 v2 Sep 16, 2005 * silenced some commands (avoiding hit-enter prompt)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000150 * began testing under Windows; works thus far
Bram Moolenaar98358622005-11-28 22:58:23 +0000151 * filetype detection fixed
152 Nov 03, 2005 * handles writing zipfiles across a network using
Bram Moolenaar9964e462007-05-05 17:54:07 +0000153 netrw#NetWrite()
Bram Moolenaar98358622005-11-28 22:58:23 +0000154 v1 Sep 15, 2005 * Initial release, had browsing, reading, and writing
155
156==============================================================================
Bram Moolenaarcb80aa22020-10-26 21:12:46 +0100157vim:tw=78:ts=8:ft=help:noet:norl:fdm=marker