Fandom

Vim Tips Wiki

Edit Java jar and other files

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 1259 Printable Monobook Previous Next

created 2006 · complexity basic · author emmby · version 7.0


Jar files are 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, read :help new-filetype and zipPlugin.vim. The latter is a plugin distributed with Vim: in Vim, put the cursor on $VIMRUNTIME/plugin/zipPlugin.vim and type gf.

For impatient people, just place the following in a file named ~/.vim/ftdetect/jar.vim (on Unix systems) or $HOME/vimfiles/ftdetect/jar.vim (on Windows systems):

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

If you open a jar file in Vim, you will be able to browse it. If that does not work, update to a recent version of Vim with zipPlugin installed.

CommentsEdit

Also on Fandom

Random Wiki