The goal of this tutorial is to rapidly tell you how to efficiently use emacs. It's not so much a tutorial as it is a brief explanation of some things you should know, combined with a list of the most useful commands.

I am not yet an emacs expert myself, so i apologize if any of this is wrong or misleading.

This page has three main sections; Beginner, Intermediate, and Advanced.


Basic commands

C-something means cntl-something.

M-something means alt-something.

ESC ESC ESC cancel (for when you accidentally trigger some command) C-g cancel current minibuffer-using command C-x C-c quit C-x C-s save C-/ undo (C-x u or C-_ are other ways to do undo) C-x C-f open file C-k cut from cursor to end of current line C-y paste C-s incremental search M-% interactive search and replace

Commands for fixing things when you accidentally do something

It's easy to accidentally trigger weird commands in emacs, so you need to know how to make things right. ESC ESC ESC and/or C-g and/or C-/ should fix most things. But some commands create new subwindows or change the buffer in your window, so you need to know how to undo those things, too.

Sometimes you'll accidentally do something which will pop up a new subwindow, and you'll want to get rid of it. Use the command:

C-x 1 close all other subwindows

Sometimes you'll accidentally do something and find that a new subwindow popped up and that the cursor has moved to the wrong subwindow. Use the command:

C-x C-o switch the active cursor to other subwindow (and then use C-x 1 to kill the other subwindow)

Sometimes you'll accidentally do something and find yourself switched to a different buffer. To get back, use the command:

C-x right arrow next buffer

Usually, applying this once will get you back to your buffer. But sometimes you may have to do a bunch of times. Eventually, this command will cycle back to the buffer you started with. If you should ever want to go in the other direction, the command is:

C-x left arrow previous buffer

Parts of the screen


Stuff to add to your .emacs

(setq inhibit-splash-screen t)

(setq column-number-mode t)

(setq load-path (cons "~/.emacs.d" load-path))

Intermediate commands

Once you're a little comfortable with emacs, the next thing to learn is how to ask the help system about unfamiliar commands. The help system should make it much easier to learn the rest of emacs.


You can use F1 instead of C-h in the help commands. There are a few special circumstances where F1 works and C-h doesn't.

C-h C-h list help commands

C-h l list last 100 keystrokes (use this when you accidentally trigger some command and you want to know what you did to trigger it)

C-h c __key sequence__ show name of the command invoked by the key sequence C-h k __key sequence__ short description of what the key sequence does (also works to tell you what a menu item does) C-h K __key sequence__ find the part of the manual that describes what the key sequence does

C-h a asks you for a query, and then gives you a list of commands whose names match your query C-h d asks you for a query, and then gives you a list of commands whose descriptions match your query

Invoking commands by name

To invoke a command by entering its name, instead of using a key sequence, use the command

M-x asks you for a command name, then invokes that command

Many commands don't have any associated key sequence, so this is the ONLY way to use those commands.


C-right Forward one word (also M-right, M-f) C-left Backward one word (also M-left, M-b)

C-l Recenter screen

C-Home Beginning of file (also M-<) C-End End of file (also M->) M-g g Goto line (also M-g M-g)

Cutting and pasting

In Emacs, there are various ways to select a region of text. Some of them are:

C-spacebar Place 'mark' at this location, and 'activate' it (moving will highlight the region in between the mark and the cursor) C-w Cut selected region


M-c capitalize M-u uppercase M-l lowercase

Process management

C-z suspend/minimize


C-q __character__ inserts __character__. Use this to insert control characters. Also C-v.

C-q followed by a sequence of octal digits inserts the character with the specified octal character code

C-x = Display the position of the cursor and the character code of character under cursor

Emacs-speak glossary

Emacs uses some unexpected terminology (for instance, 'yank' instead of 'paste'). I'm guessing that maybe emacs is so old that it came up with its terminology before the now-popular terms became popular. Below, I map some emacs terms to the closest popular equivalent (unless i made a mistake). In the rest of the page i try to use the popular terminology, rather than the emacs terminology -- except for 'buffer', because emacs will be too confusing if you don't remember what a buffer is.

kill cut
yank paste
point cursor position (technically, its a little different: point means the position in between the character that the cursor is over, and the character to the left of that)
window subwindow/frame within a window
frame window
buffer file (i think emacs says 'buffer' to distinguish the file as it is on disk from the file with unsaved changes; also, there are some special buffers which don't correspond to any file on disk)
open a file find a file
region current selection
meta key alt key
kill close (for example, emacs' command to close a buffer is called 'kill buffer')



 C-x r m        create bookmark
                (note: the bookmark isn't saved to disk until you do
                 M-x bookmark-save, or unless you save it at quitting time)
 C-x r b	goto bookmark

Managing subwindows and open files ('buffers')

(subwindows are called 'windows' by emacs)

 C-x b	     switch to buffer
 C-x C-b     list of all buffers
 C-x k	     close buffer
 C-x C-v     close buffer and open another file
 C-x o	     goto other subwindow
 C-x 1	     close all other subwindows
 C-x 0	     close subwindow
 C-x 2	     split this subwindow into 2, vertically tiled
 C-x 3	     split this subwindow into 2, horizontally tiled
 C-x +	     balance subwindows
 There are also some ways to use the mouse: 

Managing window

(emacs calls windows "frames")

C-x 5 2 create new window C-x 5 f create new window and open file in it (also C-x 5 C-f) C-x 5 d create new window and edit directory in it C-x 5 o Cycle focus

Display-buffer-other-frame: C-x 5 C-o Delete-frame: C-x 5 0 Delete-other-frames: C-x 5 1


C-x s interactively ask, for each changed buffer that is visiting a file, if it should be saved C-x i insert a file into buffer


 M-a       beginning of sentence
 M-e	   end of sentence
 C-SPC C-SPC set mark, then deactivate it
 C-x C-x   exchange mark and point 
 C-u C-SPC go backwards in the mark ring
 C-g       quit; also deactivates mark
 C-r       incremental search, backwards
           (doesn't work in viper; instead, C-s and then C-r)
	   (note: within search and replace, you can put a
	   newline into the query by using the quote
	   facility; that is, by doing C-q C-j)
 C-M-s	   regex incremental search fwd
 C-M-r	   regex incremental search backward
 M-%	   incremental string replace


 C-w 	    delete previous up to word boundary
 M-d	    delete subsequent up to word boundary
 M-f	    goto next word
 M-b	    goto prev word
 C-shift-backspace    delete whole line
 M-/ 		      autocomplete/dynamic abbreviation expand
 		      (tries to complete current word by looking
		      at words in the current buffer or in other
		      open buffers; type again to cycle through
		      possible completions; starts with first
		      completion going backwards from cursor)
 M-q		      reindent paragraph (text)
 C-M-\		      reindent region (code)


 C-h f        Help on a function
 C-h v        Help on a variable
 C-h r        Read emacs manual


 F3	      Start recording macro
 F4	      Stop recording macro
 F4	      Replay macro

Command arguments

 C-u	    	give an argument to the subsequent command. If you type a number
 		after C-u and before the next command, that number is
 		the argument; or you can type nothing to just give it
 		a default argument (many commands behave differently
 		when they get a default argument vs. no argument at
 C-6		give argument of 6 to next command (similarly for any other digit)

The "Kill ring"

 M-y   	     	After pasting ("yanking") something, if you type M-y with no
 		intervening actions, it replaces what you pasted with a previous
		paste (i.e. multiple copy/pastes are remembered). If you go too
		far backwards into the copy history (the "kill ring"), you
		can go forward again with "undo" (C-/).

Special minibuffer commands

 M-p		previous; when in the minibuffer, you can often type this
 		to get to previous remembered commands or arguments. For example, 
		after M-x, M-p gives you a previous command, and after C-s, M-p
		gives you a previous search query. Type M-p again to go further
 M-n		next; go forward in the history list (opposite of M-p)
 M-r, M-s	search backwards and forwards through history
 C-u		erase whole line

Region-specific versions of commands

 C-x C-k r    Execute macro in each line in the region
 C-x C-l      Downcase-region
 C-x C-u      Upcase-region

Some commands infrequent enough that you can use them in the menu bar


Note: when entering file names, you can put ~ or an extra / anywhere in order to make emacs ignore the previous part of the path and start with your ~ or / as if it were the beginning; for example, ~/website/tips/computer/~/notes is identical to just ~/notes, and ~/website/tips/computernotes is identical to just /notes.

Some commands infrequent enough that they aren't bound to anything

 string-insert-rectangle    	   insert the specified string at the left column of each line in the rectangle

Very advanced

Tags (requires [ TAGS file])

 M-.				goto defn of symbol under cursor
 M-0 M-.			next defn
 C-t 				return to where you were (used to be M-*?)
 M-x tags-search		grep through files mentioned in your
     				TAGS file
 M-,				next match in tags-search
 C-c RET f			goto defn of symbol under cursor (via ebrowse,
                                which is better for some types of things in C++)


 M-x artist-mode		draw ascii art with the mouse
     				(you may want to untabify the result)
 M-x untabify			replace tabs with spaces in region
 M-x align			align equals signs, hashes, etc in region
 M-x calendar			calendar
 C-x C-b                        list of all buffers. Useful for closing a lot of buffers every now and then.
 C-x * :			calculate the sum of a rectangle of numbers in the region between point and mark

i'm using viper now (with vimpulse) because i heard that emacs's chorded keys are bad for your hands, and my hands are hurt. Viper is a customization for Emacs that makes it act like Vi (and sorta like Vim).

I've only just started using it, but so far I don't see why any Emacs user would NOT use Viper. It seems to me that if you want vanilla Emacs, you could just stay in Insert mode all the time. Viper mode seems to add the option to enter Vi Mode without taking away anything. Vi Mode seems to have various functionality that may make you more efficient, such as all sorts of very quick-to-type commands to move the cursor to various places.

I recommend vimtutor to learn the basics. I also recommend,, Some of those have a lot of stuff that is in vim but not viper, so don't be surprised. The viper docs pertaining to this (also recommended) are at

Some of the following instructions apply only to viper w/ vimpulse, rather than just viper.

Modes: Press i to go into Insert mode. Insert mode is somewhat like normal emacs. Press <ESC> to get back into Normal mode. C-Z cycles b/t Emacs and Viper Normal mode.

Ex commands: When you type :, the cursor goes to the minibuffer, and you can enter an "Ex command".


 h l

Using operators (adapted from vimtutor):

               [number] operator   [number]   motion
       operator - is what to do, such as  d  for delete
       [number] - is an optional count to repeat the motion
       		  (can be first or in the middle)
		  (this document won't discuss the use of [number]
		  much, but almost all of the commands can have a
		  [number] argument which is quite useful -- try it!)
       motion   - moves over the text to operate on, such as  w (word),
		  $ (to the end of line), etc.
	e.g. d2w, d$ (C-k is faster tho), etc 

Note: usually, if you type the operator twice in a row (i.e. "dd") instead of typing a motion, the operator works on the entire current line. i usually won't list these as separate operators, but you can assume them.

Motions (can be prepended with numbers, e.g. 2w):

 hjkl	left/down/up/right
 w	to next word beginning
 e	to next word ending
 b	to prev word beginning
 W,E,B	same as w,e,b, but with "word" consisting of non-whitespace,
        rather than alphanumeric+underscore
 0	to BOL (beginning of line)
 $	to EOL (end of line)
 ^	soft BOL (beginning of line)
 }	paragraph end
 {	paragraph begin
 ]]	next "section" when programming
 [[	prev "section" when programming
 []	end of the heading of the next section
 (	sentence begin (note: you may want (setq sentence-end-double-space nil) in your .emacs)
 )	sentence end
 H	beginning of text on Highest line on screen
 M	beginning of text on Middle line on screen
 L	beginning of text on Lowest line on screen
 #G	(where # is a line number) goto line #
 gg	beginning of buffer
 G	end of buffer
 `X	goto mark X (X must be a single lowercase letter. X is stored via the command "mX"; can be viewed with "[X")
 'X	goto soft BOL containing mark X
 ``	go back to where you where before you did a jump (including /, G, `X, 'X)
 ''	go back to the line where you where before you did a jump (including /, G, `X, 'X)
 +	go down a line, and to BOL
 -	go up a line, and to BOL

Search motions:

 fX     find character X until next end of paragraph. Press ; to repeat the search, , to repeat search backwards
 tX	like fX, but put cursor before X instead of on it
 FX	like fX, but backwards
 TX	like tX, but backwards
 /	fwd search (when not motion argument of operator,
                    use n, N to go fwd, back in search results)
 ?	backward search

Text object motions (can be used with operators, but aren't actually motions):

 iX     replace X with a matching delimiter, i.e. <, (, [. "i" stands for
        "inner". applies the operators to everything inside the innermost
        set of the specified delimiter, going outwards from the cursor.
        instead of a delimiter, can use
	"w" for punctuation-delimited word, "W" for space-delimited word,
	"s" for sentence, "p" for paragraph
 aX	like iX, but includes the delimiters themselves

Note: the Emacs region can be given as a motion argument to an operator by giving 'r', or 'R' to give the smallest superset of the Emacs region containing whole lines. But r and R are not actual motions; if you type r or R alone you don't move the cursor.

Scrolling: C-f page down C-b page up C-d half page down zz keep cursor where it is, but scroll so current line is in the middle of the screen (also, Ctrl-L) zt scroll current line to top zb scroll current line to bottom X% scroll to X percent through the buffer

Search (but isn't a motion):

  1. find prev occurrence of word under cursor toggle search between case-insensitive and case-sensitive (predefined as a macro -- type fast) / toggle search between vanilla and regexp (predefined as a macro -- type fast) _ operator. find other instances of the contents of the specified region in this buffer. actually, by default, this isn't enabled. you have to put the following in your .viper: (setq viper-buffer-search-char ?_). You can replace the underscore with something else if you want to map this command to something else. :g /pat/X apply Ex command X to lines matching pattern :v /pat/X apply Ex command X to lines not matching pattern M-shift-mouse-1 find next occurrence of word under mouse (single click is sorta-alphanumeric words, double is non-whitespace, triple is lines)

Indent operators (in viper, doesn't seem to work with (some?) text objects): > indent < unindent = reindent

Indenting while in insert mode: C-t indent (at cursor) C-d unindent

Basic I/O:

 :q	quit buffer
 :w	save buffer
 :wq	save buffer, quit
 :q!	quit buffer w/o saving
 gf	open the file under the cursor

Entering insert mode:

 i  	insert before cursor
 a	insert after cursor
 I	insert at BOL
 A      append at EOL
 o	create new line above this one
 O	create new line below this one
 c	(operator) delete and then enter insert mode to replace
 C	(operator) delete until end of line and then enter insert mode to replace
 s	replace char under cursor, then insert mode
 S	blank current line, then insert mode (also, cc)

Misc editing:

 u	undo
 p	put (paste) (AFTER cursor, unlike C-y) (can prefix with "X, where X is a register)
 P 	put, but in front of cursor
 dd	delete line
 D	delete until EOL
 x	delete character at cursor (delete key doesn't do this)
 X	delete character behind cursor (backspace key doesn't do this)
 r	replace char under cursor
 yy     copy line
 ~	toggle case
 C-p	dynamic abbreviation expand (tries to complete current word by looking at words in
 	the current buffer or in other open buffers; type again to cycle through possible
	completions; starts with first completion going backwards from cursor)
 C-n	like C-p but finds first completion going forwards from cursor;
 	and repeating doesn't cycle
 xp	transpose letters (yes, this is just the x command plus
 	the p command, but i think it's neat)
 J	join lines
 C-j	newline-and-indent. a normal emacs command, not viper,
 	but especially useful when you want a
 	newline without entering insert mode.
 C-c M-p	browse history of text inserted in previous insert
     		or replace cmds
 C-c M-n	like C-c M-p, but in the opposite direction (p for prev,
     		n for next)
 :t 'X		(while in Visual mode) copy region (as entire lines)
    		to mark X	
 :move 'X	like :t, but move instead of copy
 M-shift-mouse-2 copy word under mouse to cursor

Some operators (can prefix with "X (where X is a register), i.e. "add deletes a line and saves it to register 'a'; a register can be viewed with ']X'; registers are lowercase letters; also, the last 9 copied enteries are stored in registers 1-9 (1 is the most recent); these are the same as the 9 most recent items in the "kill ring" that you go through with M-y after pasting; specifying the uppercase version of a letter means to append to that register rather than replacing it):

 d	delete
 y	copy ("yank")

Entering replace mode (like insert mode, but w/ Overwrite instead of Insert):

 R	replace mode

Misc movement:

 %	goto parens match
 	(or, if not currently on a parens, find first parens
	to the right and goto its match)
 v	enter Visual mode (selection)
 %%%	toggle whether % ignores parens within comment fields
 	(predefined as a macro -- type fast)

Replace: Q query replace regexp :s/old/new substitute once within current line :s/old/new/g substitute all within current line :#,#s/old/new/g substitute between two line #s :#,$s/old/new/g substitute between line # and EOF :%s/old/new/g substitute all :%s/old/new/gc substitute all, with confirmation :s/\<old\>/new/ like the first, but "old" only matches the whole word; it won't match "bold", for example

 &   		repeat latest Viper substitute command, e.g. :s/wrong/right

Note: "Instead of / any punctuation character other than <space> <tab> and <lf> can be used as delimiter" -- viper manual

More I/O:

 :!cmd		  execute shell command and display output in new subwindow. if cmd
 		  contains a '%', the '%' will be replaced by the
		  name of the current file
 !Mcmd		  where M is motion; run shell command on region from cursor to motion, and 
 		   replace that region with the result		   
 !!cmd		  pipe current line to shell command and replace this line with the result
 :%!cmd		  run shell command on entire buffer and replace buffer with the result
 :w FILE	  save copy as FILE
 :w 1,10 FILE	  write lines 1 to 10 to FILE
 :r FILE 	  retrieve FILE and put it below cursor position
 :6r FILE	  retrieve FILE and put it below line 6
 :e  		  revert buffer
 :e FILE	  close buffer, and open FILE
 :sh		  shell mode (same as M-x shell)
 C-c C-g	  display info about current buffer (also :f)
 :rec		  recover file from autosave
 :st		  (:stop) suspend emacs
 :W		  for each unsaved buffer, ask for
 		  confirmation and save
 :x		  save and close current buffer (also ZZ)

Buffer management

 C-^	close this buffer and go back to previous buffer
 :ar	(also :args) list currently undisplayed files
 :n	(also :next) goto next currently undisplayed file; if there are multiple
 	subwindows, display it in next subwindow
 :n N	goto Nth currently undisplayed file
 :N 	like n, but opposite
 :x,yp	display lines from x to y (x and y are line numbers) in
 	a temporary subwindow. x and y can be marks if
	preceded by aprostrophes (e.g. "'a,'bp")
 :g/pat/p	 display lines matching pattern in a temporary
 :v/pat/p	 display lines NOT matching pattern in a temporary
 To enable Visual mode, press v (or V to select by lines). In visual mode, as you move around (using all of the normal motions), the region is visibly highlighted. Then you press an operator to do something with it. Also, while in Visual mode (needs vimpulse, i think), you can do:
 :w FILE   save selection to FILE

C-v enables rectangle selection mode.


 .			repeat last full destructive command (i.e. dw)
 F12 1 			repeat 2nd-to-last full destructive cmd
     			  (predefined as a macro -- type fast)
 F12 2 			repeat 3rd-to-last full destructive cmd
     			  (predefined as a macro -- type fast)
 :set autoindent    	autoindent
 C-z			in Vi state: toggle between Emacs state and Vi state
 			in Insert state: enter Vi state just for one command
 \			in Vi state: enter Emacs state for just one command
 			(note: this is really useful for inserting just one
 m.			set mark at current location (also C-SPC)
 m<			set mark at beginning of buffer
 m>			set mark at end of buffer
 m,			pop mark (goto mark; if you do it twice, you get
 			older marks)
 m^		       	Set mark back to where it was last set with m.
 K			read man page
 :ta			goto tag (requires [ TAGS file])

Note: the mode line tells you which state you're in; <E>, <V>, , or <R>.


Register macros: @# start recording macro @X stop recording macro, save as X (X is lowercase letter) @X execute macro X @@ execute last macro (also @ <RET>) ]X view macro X (register X) @!X put last keyboard macro (incld. emacs macros) into register X

Note: The registers that macros are stored in are the same registers that serve as clipboards. It can be useful to edit a command in the main buffer, and then to place it into a register and execute it. For example, you may wish to read in the output of some external command, incorporate some part of that output into an Ex command, and then execute that; an example is given here.

Vi macros: :map X start recording vi mode macro X. X should be multiple keys. X executes macro X must be typed real fast -- this is how macro invocation is distinguished from normal commands. :map! X start recording insert mode macro X :unmap X delete macro :unmap! X delete macro M-x viper-describe-kbd-macros list macros

Subwindow management C-w o only; like C-x 1 (close other subwindows) C-w c close this subwindow C-w C-w next subwindow :b X switch to buffer X in another subwindow :B X switch to buffer X in this subwindow :split horiz split (also C-x 2, or :sp) :vsplit vert split (also C-x 3, or :vsp)

Tags (todo) C-] jump to tag at point C-t pop tag mark

For special keyboards

 C-\  			Meta (if you don't have an Alt or Meta key; usually
 			in Emacs it would be ESC but we're using that already;
			but you could also set the viper-no-multiple-ESC to
			nil in your .viper)
 \ C-\			(in Vi state) toggle-input-method (multilingual stuff;
   			usually bound to C-\ in emacs)

Here's my .viper:

(setq viper-expert-level  '5)
(setq viper-inhibit-startup-message 't)

(setq viper-want-ctl-h-help 't)

(defun kill-this-buffer ()
  (kill-buffer (current-buffer))

(defun query-kill-this-buffer ()
  (if (and (buffer-modified-p) buffer-file-name)
    (if (y-or-n-p "Buffer modified, save? ")
      (progn (save-buffer) (kill-this-buffer))
      (progn (set-buffer-modified-p nil) (kill-this-buffer))

(defun quit-buffer ()
(if server-buffer-clients

(define-key viper-vi-global-user-map "qq" 'quit-buffer)
(define-key viper-vi-global-user-map "qw" 'save-buffer)
(define-key viper-vi-global-user-map "qa" 'viper-ex)
(define-key viper-vi-global-user-map "qe" (lookup-key global-map (kbd "C-/"))) ;; this is b/c I use C-/ instead of C-x; you probably want C-x here
(define-key viper-vi-global-user-map "qf" 'find-file)
(define-key viper-vi-global-user-map "qb" 'bookmark-jump)

Also, i remapped Caps Lock to Escape in Xwindows, via the following bit in a file called ~/.Xmodmap:

remove Lock = Caps_Lock
keysym Caps_Lock = Escape

I had to do something to execute "xmodmap ~/.Xmodmap" at X startup, but I forgot what it was.

copied from elsewhere, to integrate:

Delete the current window: C-x 0 Maximize the current window: C-x 1 Split current window horizontally: C-x 2 Split current window vertically: C-x 3 Balance window sizes/positions: C-x + Select next window: C-x o

Buffer menu (list of buffers): C-x C-b Switch to another buffer: C-x b Insert a file into buffer: C-x i Kill (close) a buffer: C-x k Kill current buffer & open another file: C-x C-v

Display next frame: C-x 5 o Display-buffer-other-frame: C-x 5 C-o Delete-frame: C-x 5 0 Delete-other-frames: C-x 5 1 Make-frame-command: C-x 5 2 Find-file-other-frame: C-x 5 f or C-x 5 C-f Dired-other-frame (directory editor): C-x 5 d [edit] Emulation modes

Digital Equipment EDT editor: M-x edt-emulation-on TPU (DEC VMS editor): M-x tpu-edt-on Crisp editor: M-x crisp-mode WordStar? (old wordprocessor): M-x wordstar-mode Vi modes: M-x vi-mode, M-x vip-mode, M-x viper-mode

Listed above are just some emulation modes, custom sets can be created or downloaded & installed.

[edit] Built-in emacs Help

Get help: C-h Read emacs manual: C-h r Activate emacs tutorial: C-h t Display what a given key/command does in the echo area: C-h c (followed by a key/command) Give a detailed description of what a given key/command does: C-h k (followed by a key/command) [edit]

 C-x C-b to get a buffer list, and you can go through it and hit "d" do tag buffers for deletion, then "x" to do the deletions.

M-x shell

Bookmarks are really neat too. Instead of typing in "C-x C-f /" I can just type in "C-x r b ufies" and my "ufies"

 For file maintenance there is "dired", the program that does
 directory maintenance. You can go through a list of files and hit "d"
 to mark for deletion, or "~" to tag all <filename~> files, or "#" for
 all emacs backup files etc. Then "x" will actually execute the events
 you've tagged to happen

M-x ispell-buffer

    C-      [hold-CTRL]
    M-      [hold-META] or [hold-ALT] or [ESC-and-release]
    C-u #   pass number to a command
    File controll:
    C-x C-s save
    C-x C-w save as...
    C-x   s save all files
    C-x C-c quit
    C-x C-f open (new) file
    C-a     jump to beginning of line
    C-e     jump to end of line
    C-s     search (forward)
    C-r     search (backward)
    C-v     = page down key
    M-v     = page up key
    M-b     word back
    M-f     word forward
    C-b     = left arrow key
    C-n     = down arrow key
    C-p     = up arrow key
    C-f     = right arrow key
    M-x goto-line n = goto line "n"
    M-<     goto beginning of document
    M->     goto end of document
    Text manipulation:
    C-k     delete all characters after cursor on the cursors line
    M-d     delete word
    C-d     delete character
    C-x   u undo (or C-_)
    C-SPC   start mark
    M-w     copy marked text to copy buffer
    C-w     cut marked text to copy buffer
    C-y     paste above cursor
    M-u     upppercase word (from cursor)
    M-l     lowercase word (from cursor)
    Search & Replace:
    M-%     replace string
    M-C-%   regex replacement (or use : M-x query-replace-regexp)
       replace this one, go on to next        SPC or y
       skip to next without replacing         DEL or n
       replace all remaining matches          ! 
       exit query-replace                     ESC or RET 
       enter recursive edit (M-C-c to exit)   C-r 
    mark block (C-SPC)...
    M-x comment-region[RET]
    M-x uncomment-region[RET]
    Window/buffer manipulation:
    C-x   0 delete window
    C-x   1 delete other window(s)
    C-x   2 split window horizontal
    C-x   3 split window vertical
    C-x  <- (left) previous buffer
    C-x  -> (right) delete buffer
    C-x C-b list buffers
    C-x   b switch to buffer (TAB to list buffers)
    C-x   o switch to other window
    C-x   k <ENTER> = kill current buffer
    C-x     equalise all windows
    C-u 22 C-x ^     Enlage window with 22 lines
    M-!     open a shell
    M-x     <shell> = open a subshell in a new window buffer
    C-x r o vertically places whitespace(s) between mark and cursor
    C-x r t replaces all text between mark and cursor
    C-x r k kill (delete) all text between mark and cursor
    C-x r y insert the recently killed rectangle
    The rest:
    F10     use the menu bar (also M-`)
    C-g     quit current command (in case you'r stuck)
    The buffer list:
    The list all buffers (C-x C-b) window has some usefull shortcuts...
    u = 1 line down 
    p = 1 line up
    e = edit the selected buffer in the current "buffer list" window
        also [ENTER]
    o = edit the selected buffer in the other window
    C-o = the same as "o", but don't select the window
    d = mark(D) buffer for deletion
        also k (kill)
    s = mark(S) buffer for extra save 
    x = execute buffer markers (like deleting all marked buffers)
    b = rotate buffers below the cursor

VIPER mode...

M-x load-library[RET] viper[RET] M-x viper-mode[RET] 3[RET]

M-x viper-go-away[RET]

I was currently in the directory indicated, i.e. tmp/tmp. I knew that the file I wanted began with the string `Sum', but didn't remember the rest, so I took advantage of emacs's name completion feature: I hit the Space bar, resulting in emacs creating and displaying a buffer named *Completions*,6 with contents

Possible completions are: Sum Sum.c Sum.lst Sum.mas Sum.out Sum.sym

you can put new emacs lisp libaries in /usr/local/share/emacs/site-lisp/

bugs to report (todo):

After doing /query, and then :g/str/p, if you type / again, the minibuffer says the default is query but it actually str.

doc bug: says:

:[x,y]g/<string>/<cmd> Search globally [from line x to y] for <string> and execute the Ex <cmd> on each occurrence. :[x,y]v/<string>/<cmd> Execute <cmd> on the lines that don't match. ... :global /<pattern>/<ex-command> :g /<pattern>/<ex-command> Execute <ex-command> on all lines that match <pattern>. :vglobal /<pattern>/<ex-command> :v /<pattern>/<ex-command> Execute <ex-command> on all lines that do not match <pattern>.

but g/str/p treats str as a pattern.

doc bug: says:

<count> ["<a-z1-9>]p Put the contents of the (default undo) buffer <count> times after the cursor. The register will be automatically down-cased. <count> ["<a-z1-9>]P Put the contents of the (default undo) buffer <count> times before the cursor. The register will

this is truncated.