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