[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vim like auto indent mode

From: Alan Mackenzie
Subject: Re: Vim like auto indent mode
Date: Thu, 20 May 2004 08:20:43 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

Ding Lei <address@hidden> wrote on Wed, 19 May 2004 15:55:00 +0800:
> Hello folks,

>       Under JDE/C++/C mode, Emacs will auto indent upon some symbols
>       like an ending parenthess("{") or a semi-colon, but I really hope
>       that it will auto indent immediately I press the return key.  For
>       example, When I type:

>       for (;;;) {

>       Emacs should indent by one tab, but actually it now will indent
>       only after I type the semicolon.
>       Any Ideas ? Thanks in advance.  

I take it you mean you want Emacs to indent the _new_ line after pressing
<return>, not the line with the "for (;;;) {".  Do one of the following:

(i) On the new line, you can use <tab> at any time to indent the line;

(ii) If you use C-j instead of <return> it should do what you want, but
you probably won't like typing C-j all the time )-;

(iii) Bind <return> to what you want, by putting this into your .emacs:
(eval-after-load "cc-mode"
  '(define-key c-mode-base-map "\C-m" 'c-context-line-break))

> D i n g    L e i

Alan Mackenzie (Munich, Germany)
Email: address@hidden; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

reply via email to

[Prev in Thread] Current Thread [Next in Thread]