Skip to content

Commit 14fe569

Browse files
Alexander Kurilovichvim-scripts
authored andcommitted
Version 1.2: Remove some gzip dependencies :)
1 parent e240788 commit 14fe569

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

plugin/jad.vim

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22
" Ideas: Allow for a default to be set in the vimrc
33
" - map a keystroke to decompile and edit, or decompile and view in
44
" split window
5-
if exists("loaded_gzip") || &cp || exists("#BufReadPre#*.gz")
5+
if exists("loaded_jad") || &cp || exists("#BufReadPre#*.class")
66
finish
77
endif
8-
let loaded_gzip = 1
8+
let loaded_jad = 1
99

1010
augroup class
11-
" Remove all gzip autocommands
11+
" Remove all jad autocommands
1212
au!
1313

14-
" Enable editing of gzipped files
14+
" Enable editing of jadped files
1515
" set binary mode before reading the file
16-
" use "gzip -d", gunzip isn't always available
16+
" use "jad -d", decompile isn't always available
1717
autocmd BufReadPre,FileReadPre *.class set bin
1818
autocmd BufReadPost,FileReadPost *.class call s:read("jad")
19-
"autocmd BufWritePost,FileWritePost *.gz call s:write("gzip")
20-
"autocmd FileAppendPre *.gz call s:appre("gzip -d")
21-
"autocmd FileAppendPost *.gz call s:write("gzip")
2219
augroup END
2320

2421
" Function to check that executing "cmd [-f]" works.
@@ -36,7 +33,7 @@ fun s:check(cmd)
3633
exe "return s:have_" . name
3734
endfun
3835

39-
" After reading compressed file: Uncompress text in buffer with "cmd"
36+
" After reading decompiled file: Decompiled text in buffer with "cmd"
4037
fun s:read(cmd)
4138
" don't do anything if the cmd is not supported
4239
if !s:check(a:cmd)
@@ -52,11 +49,10 @@ fun s:read(cmd)
5249
let empty = line("'[") == 1 && line("']") == line("$")
5350
let jadfile = expand("<afile>:r") . "." . "jad"
5451
let orig = expand("<afile>")
55-
" uncompress the temp file: call system("gzip -d tmp.gz")
5652
"call system(a:cmd . " " . orig)
57-
" delete the compressed lines
53+
" delete the decompiled lines
5854
"'[,']d
59-
" read in the uncompressed lines "'[-1r tmp"
55+
" read in the decompiled lines "'[-1r tmp"
6056
set nobin
6157

6258
"Split and show code in a new window
@@ -81,13 +77,13 @@ fun s:read(cmd)
8177
"silent! exe "bwipe " . tmpe
8278
let &pm = pm_save
8379
let &ma = ma_save
84-
" When uncompressed the whole buffer, do autocommands
80+
" When decompiled the whole buffer, do autocommands
8581
"if empty
8682
" execute ":silent! doau BufReadPost " . expand("%:r")
8783
"endif
8884
endfun
8985

90-
" After writing compressed file: Compress written file with "cmd"
86+
" After writing decompiled file: compile written file with "cmd"
9187
fun s:write(cmd)
9288
" don't do anything if the cmd is not supported
9389
if s:check(a:cmd)
@@ -97,7 +93,7 @@ fun s:write(cmd)
9793
endif
9894
endfun
9995

100-
" Before appending to compressed file: Uncompress file with "cmd"
96+
" Before appending to compiled file: decompile file with "cmd"
10197
fun s:appre(cmd)
10298
" don't do anything if the cmd is not supported
10399
if s:check(a:cmd)

0 commit comments

Comments
 (0)