Skip to content

Instantly share code, notes, and snippets.

@thinca
Created April 23, 2009 17:36
Show Gist options
  • Save thinca/100632 to your computer and use it in GitHub Desktop.
Save thinca/100632 to your computer and use it in GitHub Desktop.
autocmd BufReadPost,BufNewFile *.class call s:detect_javaclass()
function! s:detect_javaclass()
let file = expand('<afile>')
if !filereadable(file)
return
endif
let line = readfile(file, 'b', 1)[0]
if 4 <= strlen(line) && line[:3] == "\xCA\xFE\xBA\xBE"
setlocal filetype=javaclass
endif
endfunction
if executable('jad')
silent %!jad -t -clear -ff -nonlb -8 -p "%"
runtime! syntax/java.vim
setlocal readonly
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment