Interesting... I thought at one point in time I had this working. Maybe
in 6.4... I lost my original .vim files that did the java indention...

--- Gerald Lai <[EMAIL PROTECTED]> wrote:

> On Fri, 2 Jun 2006, Jeff Lanzarotta wrote:
> 
> > Hello,
> >
> > I have a Java indenting questions.
> >
> > When editing C code if I have something like:
> >
> > void function(int x, int y
> >              int z)
> >
> > The second line of the declaration indents automatically, right
> under
> > the first parameter, after pressing <enter> after the 'y'.
> >
> > How can I get this to happen when I am writing Java code?
> 
> As suggested previously,
> 
>    :set cindent
>    :set cinoptions+=(4
> 
> will only indent the next line by 4 spaces plus a shiftwidth for
> every
> subsequent unclosed parenthesis.
> 
> Unfortunately, if you want Java indent to be smart enough to
> recognize
> where you end the opening parenthesis, and to continue from the same
> column on the next line, you would have to edit
> $VIMRUNTIME/indent/java.vim itself.
> 
> This is a lot of work, and would require a peculiar set of conditions
> to
> determine when you need to do this type of smart indenting. For
> instance, how would you determine if the previous line(s) was part of
> the parameter list of a function header? What if the parameter list
> stretched for more than 2 lines?
> 
> Example:
> 
>    public static void function(int x,
>                                int y,
>                                int z)
> 
> "int z)" will have trouble telling whether it needs to do the indent
> if it only looks at the previous line "int y,".
> 
> That's just a taste of the things you would need to consider when
> defining an indent file for Vim :)
> 
> --
> Gerald
> 

Reply via email to