

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


GNU Emacs
start GNU Emacs
C-z^
temporarily suspend GNUEmacs
C-x C-c
quit GNU EmacsKEYS AND THE KEYBOARD
There are a number of special keys that are used with GNU Emacs.Most commands require a combination of strokes. These are the basickey strikes that are required.CTRL or C-x
Simultaneously press CONTROL and x. This is usedto begin many different commands. META or M-
Special Emacs key used to begin many commands.This key is pressed. and then released before typingthe next character. On most systems, this is the ESCkey, but it can be changed. M-x^
Press META and then hit x
. C-u^ n^
The prefix used to designate the number of times youwant the command executed (over one), where
n^ is the
number of times. This is known as the argument of acommand. The argument comes before the command. M n^ command
This sequence is also used to repeat a command, bytyping META and then
n , where
n^ is the number of
times you want the command that follows to be exe-cuted. A buffer is somewhat analogous to a file, but it refers more specificallyto a particular editing session. Using GNU Emacs, you can open manybuffers because they are separated from the files from which they came.
C-t^
transpose character M-t^
transpose words M-x C-t
transpose lines M-C-t^
transpose sexp
C-x C-f
read a file into Emacs C-x C-s
save a file back to disk C-x i^
insert contents of another file into this buffer C-x C-v
replace this file with the file you really want C-x C-w
write buffer to a specified file C-x d^
run Dired, the directory editor
You can print an entire file (buffer), or you can print a particular regiondefined by mark and point.lpr regionlpr buffer
The Help system is simple. Type C-h and follow the directions. If youare a first time user, type C-h t for a tutorial (This card assumes youknow the tutorial).C-x 1^
get rid of Help (or any other) window a.bd ESC C-v!
scroll Help window C-h a^
apropos: show commands matching a string C-h a^
show the function a key runs C-h f^
describe a function C-h m^
get current mode-specific information
C-g^
abort partially typed or executing command M-x recover-file
recover a file lost by a system crash C-x or C-_
undo an unwanted change M-x revert-buffer
restores a buffer to its original contents C-l^
redraw screen with cursor line in the centerof bufferINCREMENTAL SEARCH C-s^
search forward C-r^
search backward M-C-s^
regular expression match Use C-s or C-r again to repeat the searching either directionESC^
exit incremental search DEL^
undo effect of last character C-g^
abort current search (also the general abort command) If GNU Emacs is still searching, C-g will cancel the part of the searchnot done, otherwise it aborts the entire search.
Cursor Motion:backward
forward
entity to move over
C-b^
C-f^
character
M-b^
M-f^
word
C-p^
C-n^
line
C-a^
C-e^
go to beginning (or end) of sentence
M-[^
paragraph
C-x [^
C-x ]^
page
M-C-b^
M-C-f^
sexp (for programming languages)
M-C-a^
M-C-e^
function
M-<^
go to buffer beginning (or end)KILLING AND DELETING
backward
forward
entity to kill
DEL^
C-d^
character (delete, not kill)
M-DEL
M-d
word
M-0 C-k
C-k
line (to end of)
C-x DEL
M-k
sentence
M--M-C-k
M-C-k
sexp
C-w^
kill region M-z char
kill to next occurrence of char C-y^
yank back last thing killed M-y^
replace last yank with previous kill
Creates a region for a command to operate on. One end is bounded bythe mark, the other by the point. The mark remains there until you resetit, but GNU Emacs cannot show you where it is.C-@ or C-SPACE
set mark here C-x C-x
exchange point and mark
M-@^
set mark arg words away
M-h^
mark paragraph
C-x C-p
mark page
M-C-@
mark sexp
M-C-h^
mark function
C-x h^
mark entire buffer
C-x b^
select another buffer C-x C-b
list all buffers C-x k^
kill a buffer
You should use this instead of REPLACE when you want to replacesome occurrences of an expression but not all of them.M-x query replace
word newword M-%^ string newstring
interactively replace a lost string
M-x query-replace-
regexp^
using regular expressions
Valid responses in query-replace mode areSPACE
replace this one, go on to next and pause ,^
replace this one, don’t move DEL^
skip to next without replacing !^
replace all remaining matches ^^
back up to the previous match ESC^
exit query-replace C-r^
enter recursive edit (C-M-c) to exitKEYBOARD MACROS You can customize keyboard macros within a file to abbreviate asequence of keys or commands that you use frequently. This is how youdefine them.C-x (^
start defining keyboard macro C-x )^
end keyboard macro definition C-x e^
execute last-defined keyboard macro C-u C-x (
append to last keyboard macro M-x name-last-kbd-macro
name last keyboard macro
M-x insert-kbd-macro
insert lisp definition buffer
M-x^ name
to invoke a defined keyboard macroTHE MINIBUFFER
This is the bottom line in your GNU Emacs window. It echoes all com-mands.The following keys are defined in the minibuffer.TAB^
complete as much as possible SPACE
complete up to one word RETURN complete and execute?^
show possible completions C-g^
abort command Type C-x ESC to edit and repeat the last command that used theminibuffer. The following keys are then defined.M-p^
previous minibuffer command M-n^
next minibuffer command
C-x 1^
delete all other windows C-x 0^
delete this window C-x 2^
split window in two horizontally C-x 5^
split window in two vertically M-C-v^
scroll other window C-x o^
with cursor to another window M-x shrink window shorterC-x ^^
grow window taller C-x {^
shrink window narrower C-x }^
grow window wider C-x 4 b
select a buffer in other window C-x 4 f
find file in other window C-x 4 m
compose mail in other window C-x 4 d
run Dired in other window C-x 4.^
find tag in other window
indent cursor line (mode-dependent) M-C-^
indent region (mode-dependent) M-C-q^
indent sexp (mode-dependent) C-x TAB
indent region rigidly arg columns C-o^
insert new line after point M-C-o^
move rest of line vertically down C-x C-o
delete blank lines around point M-^
delete all whitespace around point M-SPC
put exactly one space at point M-q^
fill paragraph M-g^
fill-region C-x f^
set fill column C-x.^
set prefix each line starts with
find tag
C-u M-. tag
find next occurrence of tag
M-x visit-tags-table
specify a new tags file
M-x tags-search
reg exp search on all files in tags table
M-x tags-query-replace
query replace on all the files
M-,^
continue last tags search or query-replaceTAGS
M-.^ tag
find tag C-u M-.
tag^
find next
note: M-- means press META, release and press the minus (-) key.last word
next word
case
M-- M-u
M-u^
uppercase
M-- M-l
M-l^
lowercase
M-- M-c
M-c^
capitalize
C-x C-u
uppercase region C-x C-l
lowercase region M-x^
capitalize regionSPELLING CHECK M-$^
check spelling of current word M-x spell-region
check spelling of all words in region M-x spell-buffer
check spelling of entire buffer If the word is incorrect, GNU Emacs will ask you to edit it, and willthen do a query replace (so you must use the query replace commandsto actually fix your mistakes).
The following have special meaning inside a regular expression.. (dot)^
any single character *^
zero or more repeats +^
one or more repeats ?^
zero or one repeat [...]^
any character in set [^...]^
any character not in set ^^
beginning of line $^
end of line ^
quote a special character c |^
alternative or (...)^
grouping \n^
nth group ^
beginning of buffer \’^
end of buffer \b^
word break \B^
not beginning or end of word <^
beginning of word >^
end of word \w^
any word-syntax character \W^
any non-word-syntax character \s c^
character with syntax c \S c^
character with syntax not c