pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)
[personal profile] pne

(The title of this entry is from an old cartoon that appears here, among other places -- does anyone know the original source?)

The group here has settled on using emacs as their preferred editor and developers have customised it, as the saying goes, to within an inch of their lives.

While there is, apparently, a good deal of rivalry between vi users and emacs users, I use vim mostly because they taught me vi when I learned Unix, so it's what I know. I have no enmity against emacs, but I just never learned it so far and saw little need to.

However, I've decided to give emacs a go, mostly because of said customisation. That way, if someone says that something is done by pressing F4, I can duplicate that without having to figure out what I'd have to do by hand.

Fortunately, the arrow keys and PgUp/PgDown work; I think I'd go bananas if I had to use Ctrl+P etc. to move around.

I have a feeling I'll only scratch the surface, partly because there are so many features that reading the docs looking for interesting or immediately useful ones is probably not easily possible.

However, if any of you are emacs users, are there commands or options or something you'd like to recommend I consider learning? As in, if I only memorise twenty (or other small-ish number) commands, which ones would be the most useful, in your opinions? For the purposes of this exercise, imagine I know basically nothing.

Date: Friday, 6 July 2007 00:58 (UTC)
subbes: A line-drawing of a jar labelled "Brand's Essence of Chicken" (Default)
From: [personal profile] subbes
Whatever shortcut closes emacs and opens pico instead. ;)

Date: Friday, 6 July 2007 01:25 (UTC)
From: [identity profile] nik-w.livejournal.com
There are millions of emacs commands, and I'm sure there's loads of really useful things, but these are commands I can't live without!:)

I assume you know the standard unix things like C-a & C-e for beginning and end of line, as well as C-k & C-y for kill (cut) and yank (paste) lines - those still work in emacs, so here are some emacs specific ones...

  • Save file: C-x C-s

  • Close emacs: C-x C-c

  • Undo: C-_ (that might work as CTRL + underscore or it might work as CTRL + - (though not on the numeric keypad)

  • Interactive search (search as you type): C-s (once search has started, C-s again will find next)

  • Keyboard quit (quits from current lisp command or mini buffer - e.g. if you hit a key combination by mistake): C-g

  • Goto line: C-c C-l

  • Open file: C-x C-f

  • Switch to other buffer in current window: C-x b (prompts for buffer you want to switch to)

  • List all open buffers: C-x C-b

  • Open file in other window (splits window in two horizontally and prompts for file to open): C-x 4 f

  • Open buffer in other window (splits window in two horizontally and prompts for buffer to open): C-x 4 b

  • Open eshell in current buffer (I generally open the scratch buffer in a new window before doing this): M-x eshell

  • Close current window (only possible when multiple windows are open): C-x 0

  • Split window vertically (effectively gives you two copies of the same file, so you can keep one part on screen in one half of the window and scroll to another part in the other window): C-x 2

  • Split window horizontally: C-x 3 (ok, I don't actually use this, but you might have a use for it - if nothing else, you can use a combination of C-x 2 & C-x 3 to give you 16 windows - each one 20x4 chars in size!:p)


If you forget the command sequence for something, most things can be done through M-x command-name (such as M-x goto-line) or you can check what a key combination does with C-h k or M-x describe-key.

Date: Friday, 6 July 2007 05:06 (UTC)
ext_78: A picture of a plush animal. It looks a bit like a cross between a duck and a platypus. (Default)
From: [identity profile] pne.livejournal.com
Thank you!

Oh, and

I assume you know the standard unix things like C-a & C-e for beginning and end of line, as well as C-k & C-y for kill (cut) and yank (paste) lines

No, I'm not familiar with those. Back when I used the Korn shell, I regularly used vi line editing rather than emacs line editing, and when I use the bash, I usually use cursor keys and Home/End, since that's usually worked so far. I think the only emacs command I've used on the command line is C-r to find a command in my history.

Date: Friday, 6 July 2007 10:50 (UTC)
From: [identity profile] nik-w.livejournal.com
well [home] and [end] should work in emacs, but if they don't, let me know and I'll show you how to make them work!:)

C-k will cut (kill) everything from the cursor to the end of the line (or multiple lines if you keep pressing it quickly). C-y will then paste (yank) that back out into the document at the current cursor position :)

Profile

pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)
Philip Newton

June 2015

S M T W T F S
 12 3456
78910111213
14151617181920
2122232425 2627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Thursday, 1 January 2026 10:12
Powered by Dreamwidth Studios