0% found this document useful (0 votes)
29 views2 pages

Emacs Survival Card For Version 28

This document provides a summary of key commands and functions for the GNU Emacs text editor. It outlines commands for searching and replacing text, working with buffers and windows, killing and copying text, compiling code, reading mail, and more. Keyboard shortcuts are prefixed with "C-" for Ctrl and "M-" for Meta or Alt.

Uploaded by

dirdecorda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Emacs Survival Card For Version 28

This document provides a summary of key commands and functions for the GNU Emacs text editor. It outlines commands for searching and replacing text, working with buffers and windows, killing and copying text, compiling code, reading mail, and more. Keyboard shortcuts are prefixed with "C-" for Ctrl and "M-" for Meta or Alt.

Uploaded by

dirdecorda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

GNU Emacs Survival Card Searching

for version 28 C-s search for a string


C-r search for a string backwards
RET quit searching
In the following, C-z means hit the ‘z’ key while holding M-C-s regular expression search
down the Ctrl key. M-z means hit the ‘z’ key while hitting M-C-r reverse regular expression search
the Meta (labeled Alt on some keyboards) or after hitting Use C-s or C-r again to repeat the search in either direction.
Esc key.
Tags
Running Emacs Tags tables files record locations of function and procedure
To enter GNU Emacs, just type its name: emacs. Emacs definitions, global variables, data types and anything else
divides the frame into several areas: menu line, buffer area convenient. To create a tags table file, type ‘etags input files’
with the edited text, mode line describing the buffer in the as a shell command.
window above it, and a minibuffer/echo area in the last line.
M-. find a definition
C-x C-c quit Emacs M-* pop back to where M-. was last invoked
C-x C-f edit file; this command uses the minibuffer to M-x tags-query-replace run query-replace on all files
read the file name; use this to create new files recorded in tags table
by entering the name of the new file M-, continue last tags search or query-replace
C-x C-s save the file
C-x k kill a buffer Compiling
C-g in most context: cancel, stop, abort partially M-x compile compile code in active window
typed or executing command C-c C-c go to the next compiler error, when in the
C-x u undo compile window or
C-x ‘ when in the window with source code
Moving About
C-l scroll current line to center of window Dired, the Directory Editor
C-x b switch to another buffer C-x d invoke Dired
M-< move to beginning of buffer d flag this file for deletion
M-> move to end of buffer ~ flag all backup files for deletion
M-g M-g go to a given line number u remove deletion flag
x delete the files flagged for deletion
Multiple Windows C copy file
C-x 0 remove the current window from the display g update the Dired buffer
C-x 1 make active window the only window f visit the file described on the current line
C-x 2 split window horizontally s switch between alphabetical date/time order
C-x 3 split window vertically
C-x o move to other window Reading and Sending Mail
M-x rmail start reading mail
Regions q quit reading mail
Emacs defines a ‘region’ as the space between the mark and h show headers
the point. A mark is set with C-space. The point is at the d mark the current message for deletion
cursor position. x remove all messages marked for deletion
M-h mark entire paragraph C-x m begin composing a message
C-x h mark entire buffer C-c C-c send the message and switch to another buffer
C-c C-f C-c move to the ‘Cc’ header field, creating one if
Killing and Copying there is none
C-w kill region
M-w copy region to kill-ring Miscellaneous
C-k kill from the cursor all the way to the end of M-q fill paragraph
the line M-/ expand previous word dynamically
M-DEL kill word C-z iconify (suspend) Emacs when running it
C-y yank back the last kill (C-w C-y combination under X or shell, respectively
could be used to move text around) M-x revert-buffer replace the text being edited with the
M-y replace last yank with previous kill text of the file on disk
Query Replace Spelling Check
M-% interactively search and replace M-$ check spelling of word at the cursor
M-C-% using regular expressions M-x ispell-region check spelling of all words in region
Valid responses in query-replace mode are M-x ispell-buffer check spelling of entire buffer
SPC replace this one, go on to next International Character Sets
, replace this one, don’t move
DEL skip to next without replacing C-x RET C-\ select and activate input method for the
! replace all remaining matches current buffer
^ back up to the previous match C-\ enable or disable input method
RET exit query-replace M-x list-input-methods show all input methods
C-r enter recursive edit (M-C-c to exit) M-x set-language-environment specify principal language
C-x RET c set coding system for next command
Regular Expressions M-x find-file-literally visit file with no conversion of
any kind
. (dot) any single character except a newline
M-x list-coding-systems show all coding systems
* zero or more repeats
M-x prefer-coding-system choose preferred coding system
+ one or more repeats
? zero or one repeat Keyboard Macros
[. . .] denotes a class of character to match
[^. . .] negates the class C-x ( start defining a keyboard macro
\c quote characters otherwise having a special C-x ) end keyboard macro definition
meaning in regular expressions C-x e execute last-defined keyboard macro
. . .\|. . .\|. . . matches one of the alternatives (“or”) C-u C-x ( append to last keyboard macro
\( . . . \) groups a series of pattern elements to a single M-x name-last-kbd-macro name last keyboard macro
element
\n same text as nth group
Simple Customization
^ matches at line beginning M-x customize customize variables and faces
$ matches at line end
\w matches word-syntax character Getting Help
\W matches non-word-syntax character Emacs does command completion for you. Typing M-x tab or
\< matches at word beginning space gives a list of Emacs commands.
\> matches at word end C-h Emacs help
\b matches at word break C-h t run the Emacs tutorial
\B matches at non-word break C-h i enter Info, the documentation browser
C-h a show commands matching a string (apropos)
Registers C-h k display documentation of the function invoked
C-x r s save region in register by keystroke
C-x r i insert register contents into buffer Emacs gets into different modes, each of which customizes
C-x r SPC save value of point in register Emacs for editing text of a particular sort. The mode line
C-x r j jump to point saved in register contains names of the current modes, in parentheses.
Rectangles C-h m get mode-specific information
C-x r r copy rectangle to register
C-x r k kill rectangle
C-x r y yank rectangle
C-x r t prefix each line with a string
C-x r o open rectangle, shifting text right
C-x r c blank out rectangle

Shells
M-x shell start a shell within Emacs
M-! execute a shell command
M-| run a shell command on the region
Copyright c 2022 Free Software Foundation, Inc.
C-u M-| filter region through a shell command For GNU Emacs version 28
Author Wlodek Bzyl ([email protected])
Released under the terms of the GNU
General Public License version 3 or later.
For more Emacs documentation, and the TEX
source for this card, see the Emacs distribution,
or https://www.gnu.org/software/emacs

You might also like