Vim Tips Wiki

Edit Java jar and other files

Redirected from VimTip1259

1,616pages on
this wiki
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.


Around Wikia's network

Random Wiki