The problem with info files about emacs key shortcuts is that they either
show you only the most basic stuff, and you will get stuck when you want to
do something, or they show you all the goods, so you don't know what you
need to know, and what you can forget about.
The commands here are presented in layers. What I need most often and
what is useful for simple general tasks is at the top. More complicated
stuff, like automation of tasks or language specific expansions are
below.
Basic Keys
General |
Undo |
C-x u |
Abort command |
C-g |
Shell |
Buffer *shell* |
M-x shell |
Excecute command |
M-! |
Shell-command-on-region |
M-| |
Rectangles (C-x r) |
Kill rectangle |
C-x r k |
Paste rectangle |
C-x r y |
Insert('open') rectangle |
C-x r o |
M-x UP = last M-x |
M-x = ESC (release) x, ALT
(hold) x^ |
C-x = CONTROL (hold)
x |
S-x = SHIFT (hold) x |
|
^ ALT is better, as you can hold it down
and just need to push one key to reuse a
meta command repeatedly.
|
Files (C-x) |
Open File |
C-x C-f |
Open File in this Buffer |
C-x C-v |
Safe Buffer |
C-x C-s |
Quit Emacs |
C-x C-c |
Safe Buffer As... |
C-x C-w |
Windows (C-x) |
One window |
C-x 1 |
Split Window Horizontal |
C-x 2 |
Split Window Vertical |
C-x 3 |
Switch to other Window |
C-x o |
Buffers (C-x) |
Goto Buffer |
C-x b |
Buffer List |
C-x C-b |
Kill Buffer |
C-x k |
|
|
Editing, Cut and Paste |
Set Mark |
C-SPACE |
Cut & delete |
C-w |
Paste |
C-y |
Cut & delete rest line |
C-k |
Search and Replace |
Search forward |
C-s text |
Search again |
C-s C-s |
Search backward |
C-r text |
Search regexp |
M-C-s regexp |
Goto line |
M-g |
Replace |
M-% |
Replace regexp |
M-C-% regexp |
Replace discard |
n |
Replace accept |
y |
Replace all rest |
! |
|
|
Intermediate Stuff
Moving |
Move Word |
C-arrow |
Move Paren |
M-arrow |
Recenter sceen |
C-l |
Editing |
Uppercase word/region |
M-u / C-x C-u |
Lowercase word/region |
M-l / C-x C-l |
Capitalize word |
M-c |
Transpose chars/lines |
C-t / C-x C-t |
Paste Clipboard |
S-INS |
Cut to Clipboard |
S-DEL |
Delete region |
C-DEL |
Previous yank |
M-y |
Keyboard Macros |
Begin recording |
C-x ( |
Stop recording |
C-x ) |
Execute macro |
C-x e |
Edit last macro |
C-x C-k |
Various |
Choose mode |
--*-perl-*-- in 1st line |
Count chars |
M-= |
Evaluate lisp |
M-: |
Run shell command on region |
M-| |
Insert file |
C-x i |
Mark buffer |
C-x h |
Prefix command |
C-u |
Expand last abbrev |
C-x a e |
|
|
Dired mode |
Use C-u for R option to list
dirs recursively. |
Flag for delete |
d |
Delete |
x |
Mark/Unmark |
m/u |
Search in marked |
A |
Mark by regexp |
% |
HTML mode |
Close tag |
C-c / |
Entity |
C-c char |
Tag region |
C-z letter |
Fold/Unfold element |
C-c C-f/u C-e |
SQL mode (M-x sql-oracle) |
Copy region to SQL |
C-c C-r |
Copy Buffer to SQL |
C-c C-b |
BibTex mode |
Article |
C-c C-b C-a |
Next field |
C-j |
Clean entry |
C-c C-c |
Field Help |
C-c ? |
Info mode |
tutorial, command list |
h, i |
next, previous, up a node |
n, p, u |
next link, follow link |
<TAB>, <RET> |
back |
l ("el") |
quit |
q |
Search |
s regex |
CVS mode |
open (other window) |
f(o) |
cvs diff |
= |
update |
O |
commit |
c, msg C-c C-c |
add, remove(careful!) |
a,r |
mark, unmark |
m,u |
dir status |
M-s |
log |
l |
AucTeX/RefTeX mode |
outline (directory) |
C-c = |
section |
C-c C-s |
Font face to bold/italics |
C-c C-f C-b/e |
|
|
|
|
Help C-h |
Apropos |
C-h a |
Info Reader |
C-h i |
Key Bindings |
C-h k |
Describe func |
C-h f |
Describe var |
C-h v |
Hard TAB |
s-TAB |
|
|
Terminal |
If your special
keys won't work. |
Beginning of line |
C-a |
End of line |
C-e |
Right (forward) |
C-f |
Left (backward) |
C-b |
Up |
C-p |
Down |
C-n |
Pagedown |
C-v |
Pageup |
M-v |
Begin |
M-< |
End |
M-> |
Forward word |
M-f |
Delete |
C-d |
|
|
Customizing
Useful stuff for the .emacs
file |
Syntax highlighting |
(font-lock-mode 1) |
Delete forward |
(setq delete-key-deletes-forward 1) |
Expansion on |
(abbrev-mode 1) |
Paren highlighting |
(paren-set-mode 'sexp) |
Show line number |
(setq-default line-number-mode 1) |
Define abbreviation |
(define-abbrev sql-mode-abbrev-table "pl"
"dbms_output.put_line()") |
Define macro |
(defalias 'sql-gutschrift (read-kbd-macro
"macro description")) |
Set key to anonymous function |
(global-set-key [f1] '(lambda()
(interactive) (insert-string "Hi"))) |
Set key shortcuts |
(global-set-key [f3] 'fill-paragraph) |
|
|
Installing libraries: Simply drop the .el modules into your load
path. For finding out what that path is, evaluate load-path.
Installing info files: simply drop them into your info path. For
finding out what that path is, evaluate info-directory-list. Usually
its some info subdirectory of your emacs installation. Then you have
to edit the root info file (called dir), or wherever you want to hook
your new info file in, just look how the other links look like. I
guess it's (filename) that makes the info reader look for the file.
You also can use (add-to-list 'Info-default-directory-list "/my/path")
to add further directories where emacs looks for info files. You still
must edit the root info file.
Installing LaTeX for MikTeX: use AUC TeX. make or just follow
instructions, adding the auctex folder into site-lib, and edit the
.emacs file to include it into your load path. (add-to-list 'load-path
"/path/to/site-lisp/auctex/") and (load 'tex-site). You must modify
the calls in tex-mik.el, wich is called from tex-site.el to fit to
your program calls. |
Regexp syntax |
Basically the syntax ist the
same as for perl, except that whitespace and tab are not
represented by \s and \t, and that the or-pipe and grouping
parentheses have to be escaped. |
C-q C-j |
newline |
C-q TAB |
tab |
. |
any char except newline |
* |
0-n times, greedy |
+ |
1-n times, greedy |
? |
0-1 times, greedy |
*?, +?, ?? |
as above, non-greedy |
[ ... ] |
character set, ^ at start negates |
^ |
beginning of line |
$ |
end of line |
\ |
escape |
\| |
or |
\( ... \) |
grouping |
\b, \B |
word-boundary, non word-boundary |
\w, \W |
word-char, non word-char |
<SPACE> |
any whitespace |
<TAB> |
tab |
<\1> |
backref to first group |
|
|
Emacs reads DOS (end-of-line: \r\n) or Unix (end-of-line: \n) text
files. It does not display the \r (or ^M) from DOS files, but marks
tem with a \ in the mode line under DOS/Windows, and with (DOS) under
other operating systems. (Under DOS Unix files are marked with (Unix)
in the mode line.) Emacs is smart enough to write the file in the same
way it was read. When you create a new file mit Emacs on Windows, it's
a DOS type file. Which sucks when you save it via Samba to a Unix
system, since it will contain ^M's. To save a buffer with Unix EOL
format, type `C-x <RET> f unix <RET> C-x C-s'. Or add
(add-untranslated-filesystem "Z:\\mydir") to your .emacs,
wich telles Emacs to write files for that file system (e.g. your Samba
share) with Unix newlines.
|