I have been use slimv for a long time, and found it's great in braces auto complete.
However, while I was editing java file, I tried to add this code in my vimrc
"Add the closing brace only at the end of the line
function! ConditionalPairMap(open, close)
let line = getline('.')
let col = col('.')
if col < col('$') || stridx(line, a:close, col + 1) != -1
return a:open
else
return a:open . a:close . repeat("\<left>", len(a:close))
endif
endf
inoremap <expr> ( ConditionalPairMap('(', ')')
inoremap <expr> { ConditionalPairMap('{', '}')
inoremap <expr> [ ConditionalPairMap('[', ']')
Which is not smart as slimv does.
Is slimv support for java files?
Try Vim-autoclose. Possibly will work for Java.
I've been using it for a while now. It's works perfectly for PHP & JS. Only occasional problem when pasting code in. But easily solved by deleting a bunch of closing brackets at the end of the file.