Vim Tips Wiki
No edit summary
 
m (Reverted edits by 185.23.124.59 (talk | block) to last version by 196.15.16.100)
(15 intermediate revisions by 9 users not shown)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=1259
 
|id=1259
  +
|previous=1251
|title=Edit java's jar, war, ear, sar, rar files
 
  +
|next=1260
|created=June 15, 2006 18:16
+
|created=2006
 
|complexity=basic
 
|complexity=basic
 
|author=emmby
 
|author=emmby
|version=n/a
+
|version=7.0
 
|rating=32/16
 
|rating=32/16
  +
|category1=
|text=
 
  +
|category2=
Jar files are really just zip files, and you can browse them from within vim simply by treating them the same as vim treats zip files (note to the vim maintainers: can we add these to the default distribution?)
 
 
}}
 
Jar files are really just zip files, and you can browse them from within Vim simply by treating them the same as Vim treats zip files.
   
 
If you want to figure out how to do this yourself, simply read {{help|new-filetype}} and zipPlugin.vim in your runtime/plugins directory.
   
 
For impatient people, just place the following in a file named ~/.vim/ftdetect/jar.vim (if you're on Unix):
   
  +
<pre>
If you want to figure out how to do this yourself, simply read this section of the help docs: http://vimdoc.sourceforge.net/htmldoc/filetype.html&#35;new-filetype and read zipPlugin.vim in your runtime/plugins directory.
 
  +
au BufRead,BufNewFile *.jar,*.war,*.ear,*.sar,*.rar set filetype=zip
 
  +
</pre>
 
 
For those who are impatient, the skinny version is to place the following text into a file named ~/.vim/ftdetect/jar.vim (if you're on unix):
 
 
 
 
&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35; FILE START &#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;
 
 
au BufReadCmd *.jar,*.war,*.ear,*.sar,*.rar call zip&#35;Browse(expand("&lt;amatch&gt;"))
 
 
&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35; FILE END &#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;&#35;
 
 
 
 
That's it! If you vim a jar file now, you'll be able to browse it.
 
}}
 
 
== Comments ==
 
This tip works for vim7+
 
 
'''Anonymous'''
 
, June 16, 2006 12:00
 
----
 
Hi. How can I vim a jar entry such that my jad.vim will get executed and decompiled the class file? Thanks
 
   
 
If you Vim a jar file now, you'll be able to browse it.
'''Anonymous'''
 
, June 17, 2006 9:50
 
----
 
Hi all,
 
I got a problem using this tip on Win 2k with VIM 7.0 . When I use the described script in my ~\vimfiles\ftdetect directory and then want to vim a jar file, I get an error about "(zip&#35;Browse) unzip is unavailable on your system". How to get rid of this? I start with the batch file deployed in the %windir% directory. And yes, Windows has no native ~ directory, but vim maintains one.
 
Oh, before I forget, my unzipper is TugZIP (http://www.tugzip.com), because it knows almost any archive type. It even knows tar, which is pretty unlikely for a Windows program.
 
tia and cu,
 
nullplan
 
   
 
==Comments==
nullplanwichmann--AT--web.de
 
  +
This solution doesn't seem to work
, July 20, 2006 13:13
 
----
 
<!-- parsed by vimtips.py in 0.576248 seconds-->
 

Revision as of 22:16, 14 August 2015

Tip 1259 Printable Monobook Previous Next

created 2006 · complexity basic · author emmby · version 7.0


Jar files are really just zip files, and you can browse them from within Vim simply by treating them the same as Vim treats zip files.

If you want to figure out how to do this yourself, simply read :help new-filetype and zipPlugin.vim in your runtime/plugins directory.

For impatient people, just place the following in a file named ~/.vim/ftdetect/jar.vim (if you're on Unix):

au BufRead,BufNewFile *.jar,*.war,*.ear,*.sar,*.rar set filetype=zip

If you Vim a jar file now, you'll be able to browse it.

Comments

This solution doesn't seem to work