From: Hadron Quark <hadronquark@gmail.com>
Subject: Re: Hard to switch from vi
Date: Tue, 10 Oct 2006 13:53:46 +0200 [thread overview]
Message-ID: <87odskidyt.fsf@gmail.com> (raw)
In-Reply-To: 874puejlc4.fsf@thalassa.informatimago.com
Pascal Bourguignon <pjb@informatimago.com> writes:
> Wen Weng <WenWeng@charter.net> writes:
>
>> Hi, I am a vi user for years and am now trying emacs.
>> I find it hard to get efficient. Can someone teach me some
>> commands?
>
> Emacs can do it itself. The first thing emacs does, when you start
> it, is to display a screen that says:
>
> Welcome to GNU Emacs, one component of the GNU/Linux operating system.
>
> Get help C-h (Hold down CTRL and press h)
> Emacs manual C-h r
> Emacs tutorial C-h t Undo changes C-x u
> Buy manuals C-h C-m Exit Emacs C-x C-c
> Browse manuals C-h i
> Activate menubar F10 or ESC ` or M-`
> (`C-' means use the CTRL key. `M-' means use the Meta (or Alt) key.
> If you have no Meta key, you may instead type ESC followed by the character.)
>
>
>
> Then, type CTRL-h and t to get the tutorial that will teach you the
> basics.
>
>
>> 1. In vi, to delete a line, I do, "dd" and to delete 5 lines, I do
>> "5dd". In emacs, how do I delete a complete line? C-k only delete
>> from cursor to the end of line. Adding a C-a is really too much work.
>
> C-k
> C-k C-k
This doesn't do what the OP wanted. He want C-a C-k.
>
> M-5 C-k
> C-u 5 C-k
> C-5 C-k ; on X
>
>
>> 2. Is there a repeat last command command like the dot command in vi?
>
> No. But you can repeat any command by prefixing it with
> M-<digit>... or C-u <digit>...
>
> If you have a group of commands that you might want to repeat, you can
> put them in a "keyboard macro", and invoke the keyboard macro.
>
> Type: M-x apropos RET kbd-macro RET
>
>
>> 3. In vi, to find a pairing brace I use the "%" command, is there a
>> command like thins in emacs?
>
> C-c , and C-c . (backward-sexp and forward-sexp)
There are undefined in my snapshot emacs : its M-C-n and M-C-p
>
> Also, you can set the variable blink-matching-paren to true to have
> the pairing brace be highlighted automatically when the cursor passes
> over one of them.
>
> M-x set-variable RET blink-matching-paren RET t RET
>
> Or type in the *scratch* buffer:
>
> (setq blink-matching-paren t) C-x C-e
>
> If you want it always on, you can put the form:
>
> (setq blink-matching-paren t)
>
> in your ~/.emacs file.
Doesn't work in this version I am posting from :( Just tried it on a c
file and a lisp file.
GNU Emacs 22.0.50.1 (i486-pc-linux-gnu, GTK+ Version 2.8.17) of
2006-08-24 on vernadsky, modified by Debian
>
>
> Also, most of the time you don't need to identify manually the
> matching parenthese, because you can manipulate the parenthesized
> blocks as wholes, using commands such as kill-sexp (C-M-k).
>
> Imagine I want to exchange the then and else branches:
>
> if(a==b){
> printf("no");
> a++;
> }else{
> printf("yes");
> b--;
> }
>
> I move on the first {, and type C-M-k
>
> if(a==b)else{
> printf("yes");
> b--;
> }
>
> then I move forward one word with M-f to reach the remaining {, and
> type C-y to yank the first branch there:
>
> if(a==b)else{
> printf("no");
> a++;
> }{
> printf("yes");
> b--;
> }
>
>
> and I type C-M-K to kill the else branch, and type C-u 2 C-c ,
> to move at the beginning of the else.
>
> if(a==b)else{
> printf("no");
> a++;
> }
>
> then I type C-y to yank the else branch:
>
> if(a==b){
> printf("yes");
> b--;
> }else{
> printf("no");
> a++;
> }
Sounds more complicated than mark, cut and replace :)
>
> There are also specialized minor mode to do even more structuring
> editing with some languages, like paredit-mode for lisp and scheme,
> where even more low level editing is done automatically.
>
>
>
>> 4. Should I really need to switch to emacs?
>
> This is highly advised.
:))))
next prev parent reply other threads:[~2006-10-10 11:53 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-08 23:32 Hard to switch from vi Wen Weng
2006-10-09 0:12 ` Ignacio Mondino
2006-10-09 7:10 ` Lennart Borgman
2006-10-09 10:57 ` Jeremy Hankins
2006-10-09 14:47 ` Lennart Borgman
2006-10-09 17:49 ` Jeremy Hankins
[not found] ` <mailman.7914.1160393911.9609.help-gnu-emacs@gnu.org>
2006-10-10 13:03 ` Hadron Quark
2006-10-10 13:50 ` Pascal Bourguignon
2006-10-13 10:36 ` Hadron Quark
2006-10-10 14:11 ` Jeremy Hankins
[not found] ` <mailman.7909.1160377822.9609.help-gnu-emacs@gnu.org>
2006-10-10 1:39 ` Wen Weng
[not found] ` <mailman.7907.1160352764.9609.help-gnu-emacs@gnu.org>
2006-10-09 0:40 ` Wen Weng
2006-10-09 1:48 ` Ajit Mylavarapu
2006-10-09 2:03 ` ext-chunye.wang
2006-10-09 2:09 ` Pascal Bourguignon
2006-10-09 2:44 ` Wen Weng
2006-10-10 12:59 ` Hadron Quark
2006-10-09 2:04 ` Pascal Bourguignon
2006-10-10 11:53 ` Hadron Quark [this message]
2006-10-11 13:35 ` martin
2006-10-09 8:52 ` Markus Triska
2006-10-09 8:53 ` David Kastrup
2006-10-09 16:28 ` Harald Hanche-Olsen
2006-10-10 1:36 ` Wen Weng
2006-10-10 11:16 ` Markus Triska
2006-10-10 13:05 ` Hadron Quark
2006-10-10 14:02 ` Pascal Bourguignon
2006-10-10 12:20 ` Hadron Quark
2006-10-10 12:32 ` Pascal Bourguignon
2006-10-10 12:38 ` Markus Triska
2006-10-10 12:57 ` Hadron Quark
[not found] ` <45299CB0.5090003@speakeasy.net>
[not found] ` <4529A0E4.60403@charter.net>
2006-10-09 9:58 ` ken
2006-10-10 0:50 ` Stefan Monnier
[not found] ` <mailman.7911.1160387922.9609.help-gnu-emacs@gnu.org>
2006-10-10 1:22 ` Wen Weng
2006-10-10 2:23 ` Micha Feigin
2006-10-21 17:25 ` don provan
2006-10-22 19:36 ` Lennart Borgman
[not found] ` <mailman.132.1161545823.27805.help-gnu-emacs@gnu.org>
2006-10-23 17:15 ` don provan
2006-10-23 17:53 ` Lennart Borgman
2006-10-23 18:56 ` Floyd L. Davidson
2006-10-24 9:01 ` Mathias Dahl
2006-10-24 10:12 ` Floyd L. Davidson
2006-10-24 11:25 ` Mathias Dahl
2006-10-24 18:23 ` Floyd L. Davidson
2006-10-25 14:21 ` Mathias Dahl
2006-10-21 21:00 ` Dieter Wilhelm
2006-10-09 12:01 ` lgfang
2006-10-10 1:17 ` Wen Weng
2006-10-09 13:28 ` Ken Goldman
2006-10-09 15:06 ` Malte Spiess
2006-10-10 7:18 ` Giorgos Keramidas
2006-10-11 22:21 ` John Sullivan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87odskidyt.fsf@gmail.com \
--to=hadronquark@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).