On 2009-05-24, Arun wrote:
> On Sun, May 24, 2009 at 09:53:41AM +1000, Brad wrote:
> > 
> > Hi.  I'm using vim to edit java programs, but one aspect of the
> > automatic indenting is driving me crazy (it's all my fault, though,
> > as I don't subscribe (in this case) with the accepted standard).
> > 
> > Rather than have the closing brace of a block line up with the
> > beginning of the statement which started the block, like this:
> > 
> > void blah() {
> >     if (boolean) {
> >         stuff;
> >     }
> > }
> > 
> > I prefer the closing brace to be indented one step further
> > to the right, lining up with the body of the block:
> > 
> > void blah() {
> >     if (boolean) {
> >         stuff;
> >         }
> >     }
> 
> > Vim is driving me crazy by automatically left-shifting the closing
> > brace from where I want it to be.
> > 
> > I've tried various options, reading up on the various settings, but
> > setting cindent values and the like doesn't seem to have any
> > effect at all.  Is there a whole different set of options for java
> > syntax?
> > 
> > Could someone please help me out, or tell me where to look?

> Sorry, I don't know the exact solution. But you may want to modify 
> $VIMRUNTIME/indent/java.vim.

But you shouldn't.  Never modify any files under $VIMRUNTIME.  They
are likely to be overwritten the next time you update Vim to a newer
version.  Instead, you should copy the file from $VIMRUNTIME/indent
to ~/.vim/indent on Unix, or to ~/vimfiles/indent on Windows, and
make your modifications to that file.  If it's a simple change, you
may be able to put your commands in ~/.vim/after/indent/java.vim or
~/vimfiles/after/indent/java.vim.  See

    :help ftplugin-overrule

Everything it says there about the ftplugin directory applies to the
indent directory as well.  Instead of the b:did_ftplugin variable,
indent plugins use the b:did_indent variable.  See

    :help 30.3

The Java indent plugin appears to make use of the cindent
functionality.  Have you tried changing the value of the }
'cinoptions' flag?  See

    :help cinoptions-values

and search for "}N".

Regards,
Gary



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to