this is why the reference mug only comes in extra-large
Geek
Originally I was just going to embark on a long voyage of discovery into the many and varied ways of deleting text in normal modes in Emacs (I was looking for a delete-backwards equivalent to C-d, delete forwards, for various reasons). However because this involved actually reading Emacs' documentation, I actually learnt some useful things as well. Anyway, here it all is...
On deleting text
- BACKSPACE,BS,DEL
- Delete character behind the cursor.
- C-d,DELETE
- Delete character in front of cursor.
- M-\
- Delete all whitespace behind the cursor.
- M-SPC
- Delete all whitespace behind except one space (annoying to use because of Gnome window manager keybindings).
- M-^
- Delete blank lines immediately before the current line and join with the next line above.
- C-x C-o
- Delete blank lines immediately after the current line.
On killing text
- C-k
- Kill remainder of the line.
- C-M-w
- Append the next kill rather than replacing.
- C-w
- Kill current selection.
- C-y
- Yank - insert the last kill.
- M-y
- After a yank, insert the previous element of the kill ring Can be used multiple times.
- M-z
- Zap to char - Kill up to the specified char.
On windows and the mini-buffer
- C-o
- Insert a new line in the mini-buffer.
- C-x o
- Switch between windows in the current frames, including the minibuffer when active.
- C-M-v
- Scroll help text when in the minibuffer.
Those last three are things that I have wanted to know how to do for years, but have always been too lazy to look up. W00t!
Comments
Emacs?? Good god, man. Use Vim.
(Hi from New York City, by the way!)
Posted by: Dave Hill on June 22, 2005 10:36 AM
Pfft! How do you do all of this stuff in Vim? I actually entertain the thought to switch, maybe once a twice year when waiting for Emacs to start and feeling particularly at odds with the world, but then after using Vim for a few minutes I inevitably give up.
Not that I would use anything other than vi for any systems work, of course.
Still, what on earth are you doing in NYC? Is that why I haven't seen you on Jabber for a while?
Posted by: Mike on June 22, 2005 06:35 PM
I love Meta-yank more than any other feature of the Emacsen, except maybe gnuclient ;)
Posted by: Joel on June 22, 2005 07:55 PM
Mike, I'm here for one of these:
a) a religious pilgrimage;
b) the chance to find true love at the top of the Empire State Building;
c) a job offer to be a NYC cab driver;
d) the project I'm on is for a customer in NYC.
Count the cabs:
http://www.djh.id.au/~david/images/usa/new_york/manhattan/2005-05-30/gallery/IMGP1525.html
http://www.djh.id.au/~david/images/usa/new_york/manhattan/2005-05-30/gallery/IMGP1521.html
More at: http://www.djh.id.au/~david/blog/
Posted by: Dave Hill on June 22, 2005 09:20 PM
> BACKSPACE,BS,DEL
> Delete character behind the cursor.
> C-d,DELETE
> Delete character in front of cursor.
I find deleting characters in emacs to be one of the most inconsistent operations across running even the same emacs in different modes. Under the standard GNU emacs port on FreeBSD (which, on my 5.3 machine is 21.3.1), I observe the following:
1) SSH from the ssh.com client on Windows XP: DEL == delete backwards; BS == C-h (which brings up help).
2) SSH from OpenSSH_3.8.1p1 on Mac OS X: DEL == delete backwards; fn-DEL == delete forwards.
3) From the console: DEL == delete forwards; BS == delete backwards.
4) Launched under X Windows: DEL == delete forwards; BS == delete backwards.
This is the same emacs. I have given up commiting this to memory. The first thing I do after firing up an emacs session from anywhere is revise the delete keybindings of the moment by trial and error.
Posted by: Paul Hoadley on June 22, 2005 10:03 PM
Oooh. Two people telling me about {emacs|gnu}client in as many months. Maybe I willl have to check out what all the fuss is about. It is kind of like the way IE runs at ring 0, right?
Dave, you know there is an easier way to find true love, right? Try here: http://www.russianbrides.com/. I bags the one in the strappy leather thingy!
Paul, I think the rule of thumb is to let Emacs try and be clever as it likes and to just fix the terminal. I came across this http://www.squish.net/docs/delbs.html last night when, err, "researching" this "article", which looks helpful. The alternative is as Dave suggested and just run vi. Only in a terminal for remote logins, of course. You do not want to go overboard.
Posted by: Mike on June 22, 2005 10:48 PM
PS: yeah, I <3 C-y/M-y as well.
Posted by: Mike on June 22, 2005 10:49 PM
> Paul, I think the rule of thumb is to let Emacs
> try and be clever as it likes and to just fix
> the terminal.
Yeah, well the old me would have done that. But the new me is a Mac user now, and my new mantra is "Why should I care?" I know it's a termcap-style issue, and I know I could fix it if I tried hard enough---but why should I care? (Of course, the new me recognises that this attitude is going to get me nowhere in reality.)
Posted by: Paul Hoadley on June 23, 2005 09:31 AM
^^^ what he said. [long-distance bonding]
Oh, and: I know vi is superior, and use Emacs anyway.
Posted by: Joel on June 25, 2005 12:39 AM
Add a Comment