Cursor Movement

advertisement
Princeton University
COS 217: Introduction to Programming Systems
The Emacs Editor
This reference sheet assumes that Emacs is configured using the .emacs file provided to COS 217 students.
In Emacs all work is accomplished by calling functions. To call a function, type "ESC x function".
Many function calls are bound to keystrokes. These tables show some keystroke bindings. Bindings in boldace are
commonly used.
Moving the Point
Key
→
←
↓
↑
C-f
C-b
C-n
C-p
ESC f
ESC b
Home
End
C-a
C-e
ESC a
ESC e
PageDn
PageUp
C-v
ESC v
ESC <
ESC >
ESC C-a
ESC C-e
C-x l line
Function
forward-char
backward-char
next-line
previous-line
forward-char
backward-char
next-line
previous-line
forward-word
backward-word
beginning-of-line
end-of-line
beginning-of-line
end-of-line
c-beginning-of-statement
c-end-of-statement
scroll-up
scroll-down
scroll-up
scroll-down
beginning-of-buffer
end-of-buffer
beginning-of-defun
end-of-defun
goto-line
Description
Move the point forward one character
Move the point backward one character
Move the point to the next line
Move the point to the previous line
Move the point forward one character
Move the point backward one character
Move the point to the next line
Move the point to the previous line
Move the point to the next word
Move the point to the previous word
Move the point to beginning of the line (but not with some terminal apps)
Move the point to end of the line (but not with some terminal apps)
Move the point to beginning of the line
Move the point to end of the line
Move the point to the beginning of the C statement
Move the point to the end of the C statement
Move the point to the next page (but not with some terminal apps)
Move the point to the previous page (but not with some terminal apps)
Move the point to the next page
Move the point to the previous page
Move the point to the beginning of the buffer
Move the point to the end of the buffer
Move the point to the beginning of the C function
Move the point to the end of the C function
Move the point to the line whose number is line
Inserting and Deleting
Key
BSP
ESC BSP
C-d
C-k
C-SP
C-x C-x
C-x h
C-w
ESC w
C-y
C-c .
TAB
ESC C-\
C-x p
Function
c-electric-backspace
backward-kill-word
c-electric-delete-forward
kill-line
set-mark-command
exchange-point-and-mark
mark-whole-buffer
kill-region
kill-ring-save
yank
c-set-style
c-indent-command
indent-region
indent-all
Description
Delete the character before the point
Delete the characters from the point to the beginning of the word
Delete the character at the point
Cut the current line
Set the mark at the point
Exchange the mark and the point
Set the point at the beginning and the mark at the end of the buffer
Cut the region denoted by the mark and the point
Copy the region denoted by the mark and the point
Paste the previously cut/copied region at the point
Set the C indentation style to the specified one
Indent the current line of the C program
Indent the region of the C program denoted by the mark and the point
Indent all lines of the C program (i.e. indent the program perfectly)
Page 1 of 2
Searching and Replacing
Key
C-s string
C-r string
ESC % old new
Function
isearch-forward
isearch-backward
query-replace
Description
Search forward for string
Search backward for string
Replace the old string with the new one
y => replace
n => skip
! => replace all
q => quit
Reading, Writing, and Exiting
Key
C-x C-f file
C-x C-r file
C-x C-s
C-x C-w file
C-x C-q
C-x C-c
Function
find-file
find-file-read-only
save-buffer
write-file
vc-toggle-read-only
save-buffers-kill-emacs
Description
Load the specified file into a buffer
Load the specified file into a buffer for read only
Save the current buffer to its file
Write the current buffer to a specified file
Toggle the current buffer between read-only and read/write
Save all buffers and exit xemacs
Managing Windows and Buffers
Key
C-x 2
C-x o
C-x 3
C-x 0
C-x 1
C-x C-b
C-x b file
Function
split-window-vertically
other-window
split-window-horizontally
delete-window
delete-other-windows
list-buffers
switch-to-buffer
Description
Split the current window into two windows arranged vertically
Move the point to the other window
Split the current window into two windows arranged horizontally
“Undisplay” the current window
“Undisplay” all windows except the current one
Display a new window listing all buffers
Load file into a buffer if necessary, and then display that buffer in the
current window
Building and Debugging
Key
Function
compile command
gdb executablefile
Description
Build the program using command
Launch the GDB debugger to debug executablefile
Function
undo
undo
keyboard-quit
help-command
tmm-menubar
linum
Undo the previous change
Undo the previous change
Abort the multi-keystroke command
Access the Emacs help system
Access the Emacs menu
Display/undisplay a line number before each line
Miscellaneous
Key
C-x u
C-_
C-g
C-h
ESC `
C-x n
Copyright © 2009 by Robert M. Dondero, Jr.
Page 2 of 2
Download