next_inactive up previous


Essential Emacs Tips v0.1

T. Cucinotta

Conventions

[C-a] Press [Control]+[a]
[C-x] [C-f] or [C-x C-f] Press [Control]+[x], then [Control]+[f]
[A-x] Press [Alt]+[x], or press [Esc] then [x]
[A-x] [name] Press [Alt]+[x], then write 'name' (press [n][a][m][e]), then press [Enter]
[C-x] smth. to type Press [Control]+[x], then type something depending on the specific command
[Tab] Press the [Tab] key
[Tab] [Tab] Press the [Tab] key twice
[Spc] Press the Space bar
[Ent] or [Ret] Press the [Enter] or [Return] key

1 Editing files with Emacs

1.1 Don't panic

[C-g] Cancel current action. Sometimes you must retype sequence multiple times
[C-_] Undo last editing action. Repeat sequence to keep undoing as many times as you need
[C-x] [C-c] Exit Emacs

1.2 Loading and saving files

[C-x] [C-f] Open file: use minibuffer window to specify file name. Create a new file if it does not exist.
[C-x] [C-s] Save file
[C-x] [C-w] Save As: use minibuffer window to specify file name
[Tab] While in minibuffer window, completes automatically incomplete file names
[Tab] [Tab] While in minibuffer window, shows all possible file name completitions if multiple ones available

1.3 Walking through buffers

[C-x] [b] [Ret] Cycle through the two last used buffers
[C-x] [b] buf-name Switch to buffer: use minibuffer to specify new buffer to be displayed on the current window
[Tab] While in minibuffer, autocompletes incomplete buffer names
[Tab] [Tab] While in minibuffer, shows all possible buffer name completitions if multiple ones available
[C-x] [k] [Ret] Kill current buffer
[C-x] [k] buf-name Kill buffer: use minibuffer to specify name of buffer to be killed

1.4 Using the clipboard (cut and paste)

[C-Spc] Mark begin of region; move cursor to end of region and use one of [C-w] or [A-w]
[C-w] Cut region
[A-w] Copy region
[C-y] Paste last copied region from the current cursor position
[C-y] [A-y] Cycle through copied regions, pasting from the current cursor position
[C-k] Cut current line from cursor to the end. Repeat to cut multiple lines. You can paste them altogether with a single paste [C-y]

1.5 Search and replace

[C-s] smth to search Start a forward search, interactive: use minibufer to specify search word
[C-r] smth to search Start a backward search, interactive: use minibuffer to specify search word
[A-x replace-string] Search and replace: use minibuffer to enter search string first, then replace string

1.6 Managing multiple windows

[C-x 2] Split horizontally current window in two sub-windows on the same buffer
[C-x 3] Split vertically current window in two sub-windows on the same buffer
[C-x 1] Expand the current sub-window to the entire Emacs window
[C-x o] Switch to the other sub-window
[C-x 0] Kill the current sub-window

2 Programming with Emacs

2.1 Special editing modes

[A-x] [c-mode] Explicitly switch to C mode
[A-x] [c++-mode] Explicitly switch to C++ mode
[A-x] [java-mode] Explicitly switch to Java mode
[A-x] [sh-mode] Explicitly switch to Shell programming mode
[Tab] Indents the current line, if Emacs is in a programming mode
[Esc] [i] Inserts a Tab charachter
[A-x comment-region] Comment out a region. An active region must be marked
[A-x uncomment-region] Uncomment a region. An active region must be marked
[A-x c-backslash-region] Add backslashes at the end of all lines of the marked region (useful when writing multiline macros)
[A-x global-font-lock-mode] Enable syntax highlighting

2.2 Invoking the compiler

[A-x] [compile] Invoke make on the current directory: use minibuffer to supply arguments to make
[A-x] [compile] [Up] ... Cycle through last make invocations
[C-x] [`] Go to the next compilation error. Cursor is positioned on the line of the source file that caused the error.

2.3 Invoking platform documentation pages

[A-x] [man] name Invoke man: use minibuffer to enter arguments to the man command
[A-x] [man] [Ret] Invoke man on the identifier under the cursor
[A-x] [info] Invoke info

2.4 Invoking the source navigator (Speedbar)

[A-x] [speedbar] Display source navigation Speedbar
[A-x Info-speedbar-browser] Display Info navigation Speedbar

2.5 FTP remote editing

[C-x f] [/]user[@]host[:]path/to/file Connect to an FTP server for opening a remote file
[C-x f] [/]user[@]host[C-q Spc]port[:]path/to/file Connect to an FTP server on a non-standard FTP port
[C-x C-s] Upload modified file to the server

2.6 Invoking the shell

[A-x] [shell] Invoke a shell within an Emacs sub-window

3 Relaxing with Emacs

3.1 Invoking the psychotherapist

[A-x] [doctor] Invoke Emacs doctor (psychotherapist)

About this document ...

Essential Emacs Tips v0.1

This document was generated using the LaTeX2HTML translator Version 2002 (1.62)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -no_subdir -split 0 -show_section_numbers /tmp/lyx_tmpdir1644ex9SbA/lyx_tmpbuf0/EssentialEmacsTips.tex

The translation was initiated by Tommaso Cucinotta on 2003-04-09


next_inactive up previous
Tommaso Cucinotta 2003-04-09