From: Christian Neukirchen Date: 2005-09-01T01:05:45+09:00 Subject: Re: vim user switch to emacs? "Stefan Schmiedl" writes: > On Wed, 31 Aug 2005 22:20:46 +0900, Christian Neukirchen wrote: > >>> The global command, for example: >>> >>> :%g/\[CRON\]/d deletes all (uninteresting) cron entries in my auth.log >> >> C-x h M-x flush-lines \[CRON\] RET > > vim lets you put any command after the global pattern. How does emacs solve this > with its interactive parameter queries? That's not directly possible; you can, however, apply a keyboard macro (see below) to each line, which should result in about the same power. >>> :%g/Customer$/s/\([^ ]*\) \([^ ]*\)/&2, &1/g >>> .... give and take a few \ in front of parentheses ... >>> exchanges the first and second space delimited word in lines ending with Customer >> >> M-% ... RET ... ! > > I don't know enough emacs to see through the dots, but that's not important. The dots are your regex and replacement, properly escaped. :-) >> >>> Being able to record arbitrary command sequences like (not a real life example) >>> df.3j04 p (cut upto and including . and paste the deletion 3 lines down after column 4) >> >> C-x ( M-z . M-3 C-n C-a M-4 C-f C-y C-x ) > > That's the main difference for me. I just can't remember all those meta/control > combinations. the vim command maps better to my brain. I can't say I "remember" them, I just typed them and checked which keys I hit. I guess it's all in muscle memory here (Emacs lossage buffer helps seeing the keystrokes too, btw.) Still, the names are comparatively easy to remember: C-x ( and C-x ) define the macro M-z zap to char M- prefix argument C-n next line C-a beginning of line (ok, that doesn't fit) C-f forward C-y yank >>> all of this without breaking my fingers because of the unlucky >>> positioning of CTRL. >> >> Just curious: How do you leave vim's input mode? > > with a swish of the hand to the ESC button ... don't ask how often > I hit ESC while I typed this message in Opera ... ;) Interesting. In emacs, I use ESC quite often too, because you can use it as M- and there was some time my X11 emacs was broken and didn't recognize Alt. > s. -- Christian Neukirchen http://chneukirchen.org