It works, thanks! Isn't this a kind of nasty trick? :-) Does anyone know a 
cleaner solution?

Arménio Pinto

-----Original Message-----
From: Jürgen Krämer [mailto:[EMAIL PROTECTED]
Sent: terça-feira, 9 de Maio de 2006 16:04
To: vim mailing list
Subject: Re: Indentation and blank lines



Hi

Arménio Pinto wrote:
>
>      I'm using Vim to edit Java code. There's an annoying behavior
> that I would like to fix, but haven't had any success yet. The problem
> is that the indentation "disappears" when you insert blank lines. For
> example (and suppose that the "»" it's a tab):
>
> Vim does...
>
> »    »    for (String name: names) {
> »    »    »    System.out.println("name="+name);
>
> »    »    »    System.out.println("Done);
> »    »    }
>
> ... and I would like it to be:
>
> »    »    for (String name: names) {
> »    »    »    System.out.println("name="+name);
> »    »    »
> »    »    »    System.out.println("Done);
> »    »    }
>
> That is, after the first "println" I hit ENTER twice and I and would
> like that the blank line remains with indentation. How can I do this?

insert any character and delete it immediately. You can put this in a
mapping which replaces the original behaviour of ENTER:

  :inoremap <cr> <cr>X<bs>

Regards,
Jürgen

-- 
Jürgen Krämer                              Softwareentwicklung
HABEL GmbH & Co. KG                        mailto:[EMAIL PROTECTED]
Hinteres Öschle 2                          Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-Weilheim                    Fax: +49 / 74 61 / 93 53 - 99

Reply via email to