view · edit · history · print

WHY EMACS...?

If you start to hit the vi limitations while becoming a guru at your thrustworthy editor and still wonder why you should use Emacs instead if vi (becouse it served you well in the past) you could start here http://grok2.tripod.com/. Or search the web for "emacs for vi users programmers" and "viper" (a standard vi addicts emulator for Emacs) or "vi to emacs".


BEFORE WE CONTINUE...

The [RETURN] key: Many commands in emacs bring up a prompt line at the bottom of the editor screen (like the ":" command line at the bottom of the vi editor) where you need to provide additional information after which you press the Enter/Return key to cause the command to act.

The [ESCAPE] key: Unlike the Alt/Ctrl/Meta/Shift key combinations, Esc key combinations require that you press and release the Esc key before you press the next key. On Unix workstations, you may be able to use the Meta key instead of the Esc key (in which case, you would keep the Meta key pressed when pressing the next key in the key combination).

The [TAB] key: Incertain contexts a tab can be used to autocomplete. A ?-mark can be used to view autocompletion possibilities.

Reference abbreviation keys:

  1. C-x means hitting the [CONTROLL] button followed by x
  2. M-w means hitting the [META/ALT] button followed by w

EMACS REFERENCE...

 
Global:
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

Movement:
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 

Commenting:
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

Shell:
M-!     open a shell
M-x     <shell> = open a subshell in a new window buffer

Rectangles:
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]


REFERENCE...


MORE LISP CODE...

admin · attr · attach · edit · history · print
Page last modified on October 03, 2006, at 04:40 AM