Christian Brabandt | 470317f | 2025-04-16 17:13:28 +0200 | [diff] [blame] | 1 | *pi_tar.txt* For Vim version 9.1. Last change: 2025 Mar 16 |
Bram Moolenaar | c01140a | 2006-03-24 22:21:52 +0000 | [diff] [blame] | 2 | |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 3 | +====================+ |
| 4 | | Tar File Interface | |
| 5 | +====================+ |
Bram Moolenaar | 9835862 | 2005-11-28 22:58:23 +0000 | [diff] [blame] | 6 | |
Bram Moolenaar | 2963456 | 2020-01-09 21:46:04 +0100 | [diff] [blame] | 7 | Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> |
Bram Moolenaar | 9835862 | 2005-11-28 22:58:23 +0000 | [diff] [blame] | 8 | (remove NOSPAM from Campbell's email first) |
Bram Moolenaar | 2963456 | 2020-01-09 21:46:04 +0100 | [diff] [blame] | 9 | Copyright 2005-2017: *tar-copyright* |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 10 | The VIM LICENSE (see |copyright|) applies to the files in this |
| 11 | package, including tarPlugin.vim, tar.vim, and pi_tar.txt. Like |
| 12 | anything else that's except use "tar.vim" instead of "VIM". Like |
| 13 | anything else that's free, tar.vim and its associated files are |
| 14 | provided *as is* and comes with no warranty of any kind, either |
| 15 | expressed or implied. No guarantees of merchantability. No |
| 16 | guarantees of suitability for any purpose. By using this plugin, you |
| 17 | agree that in no event will the copyright holder be liable for any |
| 18 | damages resulting from the use of this software. Use at your own risk! |
Bram Moolenaar | 9835862 | 2005-11-28 22:58:23 +0000 | [diff] [blame] | 19 | |
| 20 | ============================================================================== |
| 21 | 1. Contents *tar* *tar-contents* |
| 22 | 1. Contents..................................................|tar-contents| |
| 23 | 2. Usage.....................................................|tar-usage| |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 24 | 3. Options...................................................|tar-options| |
| 25 | 4. History...................................................|tar-history| |
Bram Moolenaar | 9835862 | 2005-11-28 22:58:23 +0000 | [diff] [blame] | 26 | |
| 27 | ============================================================================== |
| 28 | 2. Usage *tar-usage* *tar-manual* |
| 29 | |
| 30 | When one edits a *.tar 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 | tar archives via the plugin. |
| 35 | |
Bram Moolenaar | 477db06 | 2010-07-28 18:17:41 +0200 | [diff] [blame] | 36 | *:Vimuntar* |
| 37 | VIMUNTAR~ |
Bram Moolenaar | 8f3f58f | 2010-01-06 20:52:26 +0100 | [diff] [blame] | 38 | |
Bram Moolenaar | 477db06 | 2010-07-28 18:17:41 +0200 | [diff] [blame] | 39 | :Vimuntar [vimhome] |
Bram Moolenaar | 8f3f58f | 2010-01-06 20:52:26 +0100 | [diff] [blame] | 40 | |
| 41 | This command copies, if necessary, the tarball to the .vim or vimfiles |
| 42 | directory using the first writable directory in the |'runtimepath'| |
| 43 | when no [vimhome] is specified. Otherwise, the [vimhome] argument |
| 44 | allows the user to specify that directory, instead. |
| 45 | |
| 46 | The copy is done using the command in *g:tar_copycmd* , which is > |
| 47 | cp for cygwin, unix, macunix |
| 48 | copy for windows (32, 95, 64, 16) |
| 49 | < The extraction is done with the command specified with |
| 50 | *g:tar_extractcmd* , which by default is > |
| 51 | "tar -xf" |
| 52 | < |
Bram Moolenaar | ff03419 | 2013-04-24 18:51:19 +0200 | [diff] [blame] | 53 | *:TarDiff* |
| 54 | DIFFERENCING SUPPORT~ |
| 55 | |
| 56 | :TarDiff [filename] |
| 57 | |
| 58 | This command will attempt to show the differences between the tarball |
| 59 | version of a file and the associated file on the system. In order to |
| 60 | find that file on the system, the script uses the path associated with |
| 61 | the file mentioned in the tarball. If the current directory is not |
| 62 | correct for that path, :TarDiff will fail to find the associated file. |
| 63 | |
| 64 | If the [filename] is given, that that filename (and path) will be used |
| 65 | to specify the associated file. |
| 66 | |
| 67 | |
Bram Moolenaar | 8f3f58f | 2010-01-06 20:52:26 +0100 | [diff] [blame] | 68 | PREVENTING LOADING~ |
| 69 | |
| 70 | If for some reason you do not wish to use vim to examine tar'd files, |
| 71 | you may put the following two variables into your <.vimrc> to prevent |
| 72 | the tar plugin from loading: > |
| 73 | |
| 74 | let g:loaded_tarPlugin= 1 |
| 75 | let g:loaded_tar = 1 |
| 76 | < |
Christian Brabandt | 470317f | 2025-04-16 17:13:28 +0200 | [diff] [blame] | 77 | *tar-mappings* |
| 78 | MAPPINGS~ |
| 79 | |
| 80 | The following (buffer-local) mappings are available in a tar buffer: |
| 81 | |
| 82 | <CR> Open selected file for editing, any changes will be |
| 83 | written back to the archive. |
| 84 | <LeftMouse> same as <CR> |
| 85 | x Extract selected file. |
Bram Moolenaar | 8f3f58f | 2010-01-06 20:52:26 +0100 | [diff] [blame] | 86 | |
Bram Moolenaar | 9835862 | 2005-11-28 22:58:23 +0000 | [diff] [blame] | 87 | ============================================================================== |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 88 | 3. Options *tar-options* |
| 89 | |
| 90 | These options are variables that one may change, typically in one's |
| 91 | <.vimrc> file. |
Bram Moolenaar | 6ebe4f9 | 2022-10-28 20:47:54 +0100 | [diff] [blame] | 92 | Default |
| 93 | Variable Value Explanation |
Bram Moolenaar | 76db9e0 | 2022-11-09 21:21:04 +0000 | [diff] [blame] | 94 | *g:tar_browseoptions* "Ptf" used to get a list of contents |
Bram Moolenaar | 6ebe4f9 | 2022-10-28 20:47:54 +0100 | [diff] [blame] | 95 | *g:tar_readoptions* "OPxf" used to extract a file from a tarball |
| 96 | *g:tar_cmd* "tar" the name of the tar program |
| 97 | *g:tar_nomax* 0 if true, file window will not be maximized |
| 98 | *g:tar_secure* undef if exists: |
Bram Moolenaar | 8f3f58f | 2010-01-06 20:52:26 +0100 | [diff] [blame] | 99 | "--"s will be used to prevent unwanted |
Bram Moolenaar | ed39e1d | 2008-08-09 17:55:22 +0000 | [diff] [blame] | 100 | option expansion in tar commands. |
| 101 | Please be sure that your tar command |
| 102 | accepts "--"; Posix compliant tar |
Bram Moolenaar | 8f3f58f | 2010-01-06 20:52:26 +0100 | [diff] [blame] | 103 | utilities do accept them. |
Bram Moolenaar | ed39e1d | 2008-08-09 17:55:22 +0000 | [diff] [blame] | 104 | if not exists: |
Bram Moolenaar | 6ebe4f9 | 2022-10-28 20:47:54 +0100 | [diff] [blame] | 105 | The tar plugin will reject any tar |
Bram Moolenaar | 8f3f58f | 2010-01-06 20:52:26 +0100 | [diff] [blame] | 106 | files or member files that begin with |
| 107 | "-" |
Bram Moolenaar | ed39e1d | 2008-08-09 17:55:22 +0000 | [diff] [blame] | 108 | Not all tar's support the "--" which is why |
| 109 | it isn't default. |
Bram Moolenaar | 76db9e0 | 2022-11-09 21:21:04 +0000 | [diff] [blame] | 110 | *g:tar_writeoptions* "uf" used to update/replace a file |
Bram Moolenaar | 910f66f | 2006-04-05 20:41:53 +0000 | [diff] [blame] | 111 | |
| 112 | |
| 113 | ============================================================================== |
| 114 | 4. History *tar-history* |
| 115 | |
Bram Moolenaar | 2963456 | 2020-01-09 21:46:04 +0100 | [diff] [blame] | 116 | v31 Apr 02, 2017 * (klartext) reported that browsing encrypted |
| 117 | files in a zip archive created unencrypted |
| 118 | swap files. I am applying a similar fix |
| 119 | used on zip.vim to tar.vim: new buffers |
| 120 | are opened with |:noswapfile|. |
| 121 | May 16, 2017 * When the mouse option isn't empty, the |
| 122 | leftmouse can be used to select a file |
| 123 | in the tar-file listing. |
| 124 | v30 Apr 22, 2014 * .tgz files are ambiguous: they may have been |
| 125 | compressed with either gzip or bzip2. Tar.vim |
| 126 | disambiguates by using unix's "file" command. |
| 127 | Feb 18, 2016 * Changed =~ to =~# where appropriate |
| 128 | Feb 18, 2017 * Now also permits xz decompression |
| 129 | v28 Jun 23, 2011 * a few more decompression options (tbz tb2 txz) |
| 130 | v27 May 31, 2011 * moved cygwin detection before g:tar_copycmd |
| 131 | handling |
| 132 | * inserted additional |:keepj| modifiers |
| 133 | * changed silent to sil! (|:silent|) |
| 134 | v26 Aug 09, 2010 * uses buffer-local instead of window variables |
| 135 | to hold tarfile name |
| 136 | * inserted keepj before 0d to protect jump list |
| 137 | v25 Jun 19, 2010 * (Jan Steffens) added support for xz |
| 138 | compression |
| 139 | v24 Apr 07, 2009 * :Untarvim command implemented |
| 140 | Sep 28, 2009 * Added lzma support |
| 141 | v22 Aug 08, 2008 * security fixes |
| 142 | v16 Jun 06, 2008 * tarfile:: used instead of tarfile: when |
| 143 | editing files inside tarballs. Fixes a |
| 144 | problem with tarballs called things like |
| 145 | c:\abc.tar. (tnx to Bill McCarthy) |
| 146 | v14 May 09, 2008 * arno caught a security bug |
| 147 | May 28, 2008 * various security improvements. Now requires |
| 148 | patch 299 which provides the fnameescape() |
| 149 | function |
| 150 | May 30, 2008 * allows one to view *.gz and *.bz2 files that |
| 151 | are in *.tar files. |
| 152 | v12 Sep 07, 2007 * &shq now used if not the empty string for |
| 153 | g:tar_shq |
| 154 | v10 May 02, 2006 * now using "redraw then echo" to show messages, |
| 155 | instead of "echo and prompt user" |
| 156 | v9 May 02, 2006 * improved detection of masquerading as tar file |
| 157 | v8 May 02, 2006 * allows editing of files that merely masquerade |
| 158 | as tar files |
| 159 | v7 Mar 22, 2006 * work on making tar plugin work across network |
| 160 | Mar 27, 2006 * g:tar_cmd now available for users to change |
| 161 | the name of the tar program to be used. By |
| 162 | default, of course, it's "tar". |
| 163 | v6 Dec 21, 2005 * writing to files not in directories caused |
| 164 | problems - fixed (pointed out by |
| 165 | Christian Robinson) |
| 166 | v5 Nov 22, 2005 * report option workaround installed |
| 167 | v3 Sep 16, 2005 * handles writing files in an archive back to |
| 168 | the archive |
| 169 | Oct 18, 2005 * <amatch> used instead of <afile> in autocmds |
| 170 | Oct 18, 2005 * handles writing to compressed archives |
| 171 | Nov 03, 2005 * handles writing tarfiles across a network |
| 172 | using netrw#NetWrite() |
| 173 | v2 * converted to use Vim7's new autoload feature |
| 174 | by Bram Moolenaar |
| 175 | v1 (original) * Michael Toren |
Christian Brabandt | 1c5728e | 2024-05-11 11:12:40 +0200 | [diff] [blame] | 176 | (see http://michael.toren.net/code/ |
| 177 | link seems dead) |
Bram Moolenaar | 9835862 | 2005-11-28 22:58:23 +0000 | [diff] [blame] | 178 | |
| 179 | ============================================================================== |
Bram Moolenaar | 8024f93 | 2020-01-14 19:29:13 +0100 | [diff] [blame] | 180 | vim:tw=78:ts=8:noet:ft=help |