help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How can I do these in Emacs?


From: Alan Mackenzie
Subject: Re: How can I do these in Emacs?
Date: Sat, 19 Apr 2003 07:46:03 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

wang yin <wy@wanglab.com> wrote on 19 Apr 2003 13:53:56 +0800:
> Hi! I'm new to Emacs. I'm used to use VIM.  But I decided to enjoy the
> Emacs world.

Excellent!  There is plenty to enjoy.

> I don't know how to do something that's simple in VIM.  I hope I can
> get help here.

> 1. How can I do something like a "o" command in vi with Emacs?  I
>    always C-e to the end of the line and press RET.  Are there any
>    faster ways?

Not really.  Vim's o command can also be slow, though, since you often
have to press <ESC> first.  Or, it can be even slower if you forget the
<ESC>, the you end up pressing "o <ESC> u o".  ;-(

However, there is nothing to stop you writing a simple command (in Emacs
lisp) or a keyboard macro which would do exactly what you want.  C-o
would be a good key to bind this to.

> 2. How can I go to start or end of the if {...} block when the pointer
>    is inside the block?

> for example:

>       if (w->backref != NOBACKREF) {
>               WFhash[w->backref] = NULL;
> -----> <pointer here> 
>                 w->backref = NOBACKREF;
>       }

C-M-u.  u stands for "up" here.  Play around with C-M-n and C-M-p, too.
They move forward and backwards over bracketed expressions.

The best way of discovering these things is in the emacs info pages,
though you've probably found these already.  In case you haven't, type:

C-h i       to get to info
m emacs     to select the emacs manual
Move the cursor down to line 75 (more or less).  There you'll see a menu
item "* Programs".  Go into this with <CR> and spend a few hours reading
the contents.  The bit about C-M-u is in the "Parentheses" item.

Have fun!

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; 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]