C-x (File, Common)#

C-x C-f Find File
C-x C-s Save File
C-x C-w Write (Save-As)
C-x C-c Quit
C-x C-z Suspend Emacs
C-x b switch-to-buffer Move to buffer specified
C-x next-buffer Move to the next buffer in the buffer list
C-x previous-buffer Move to the previous buffer in the buffer list
C-x C-b list-buffers Display the buffer list
C-x k kill-buffer Delete the buffer specified
kill-some-buffers Ask about deleting each buffer
C-x s save-some-buffers Ask whether you want to save each modified buffer

Moving Around#

C-f Forward character
M-f Forward word
C-b Back character
M-b Back word
C-a Beginning of line
M-m First non-whitespace character in line
C-e End of line
C-p Previous line
C-n Next line
M-} Forward paragraph
M-{ Back paragraph
M-< Beginning of buffer
M-> End of buffer
M-g g
M-g M-g
goto-line
C-l Re-Center display
C-l C-l Set current line to top of display
C-l C-l C-l Set current line to bottom of display

C-s Search
M-Shift-% Search & Replace
C-M-Shift-% Regex Search & Replace

Fail-safe#

M-x text-mode Text mode
M-x fundamental-mode Fundamental mode

Selecting, Killing and Pasting#

C-Space
C-@
set-mark-command Mark the beginning (or end) of a region
C-w kill-region Cut / Delete region
M-w kill-ring-save Copy the region (so it can be pasted with C-y)
C-y yank Paste most recently killed or copied text
M-y yank-pop After C-y, pastes earlier deletion
C-x C-x exchange-point-and-mark Exchange location of cursor and mark
M-h mark-paragraph Mark paragraph
C-x C-p mark-page Mark page
C-x h mark-whole-buffer Mark buffer
C-k delete to end of line
C-0 C-k delete to beginning of line

Canceling Commands and Undoing#

C-/
C-_
C-x u
Undo (one by one)
M-x revert-buffer RET Undo all changes since last save

Frame Commands#

C-x 5 o other-frame Move to other frame
C-x 5 0 delete-frame Delete current frame
C-x 5 2 make-frame Create a new frame on the current buffer
C-x 5 f find-file-other-frame Find file in a new frame
C-x 5 r find-file-read-only-other-frame find a file in a new frame, but it is read-only
C-x 5 b switch-to-buffer-other-frame Make frame and display other buffer in it

Window Commands#

C-x 2 split-window-vertically Divide current window into two windows, one above the other
C-x 3 split-window-horizontally Divide current window into two side-by-side windows
C-x > scroll-right Scroll the window right
C-x < scroll-left Scroll the window left
C-x o other-window Move to the other window. If there are several, move to the next window
C-x 0 delete-window Delete the current window
C-x 1 delete-other-windows Delete all windows but this one
delete-windows-on Delete all windows on a given buffer
C-x ^ enlarge-window Make window taller
shrink-window Make window shorter
C-x } enlarge-window-horizontally Make window wider
C-x { shrink-window-horizontally Make window narrower
C-x - shrink-window-if-larger-than-buffer Make window smaller if buffer is smaller than window
C-x + balance-windows Make windows the same size
C-M-v scroll-other-window Scroll other window
C-x 4 f find-file-other-window Find a file in the other window
C-x 4 b switch-to-buffer-other-window Select a buffer in the other window
compare-windows Compare this window with the next window and show the first difference

Compilation mode commands#

C-x ` next-error Move to the next error message and visit the corresponding source code
M-n compilation-next-error Move to the next error message
M-p compilation-previous-error Move the previous error message
C-c C-c compilation-goto-error Visit the source code for the current error message
Space scroll-down Scroll down one screen
Del scroll-up Scroll up one screen

Python Mode#

C-j Insert a new line with the same indentation level as the current line
RET Insert a new line with the same indentation level as the current line
C-M-a Go to the beginning of the current function or class
C-M-e Go to the end of the current function or class
C-M-h Mark the current function or class for copying, etc.
C-M-x Execute the current function or class
C-c C-b Submit a bug report
C-c C-c Execute the buffer (i.e., the file being displayed)
C-c C-d Trace the stack of the process being executed
C-c C-h Get context-based help
C-c TAB Indent a highlighted (or marked) region
C-c C-k Mark a block of text. Using this at the head of a class or function definition will mark the entire block.
C-c C-l Shift the region to the left. If the cursor is in the middle of a region, the lower half of the region will shift.
C-c RET Execute the current file, opening a new window to show the output.
C-c C-n Jump to the next statement.
C-c C-p Jump to the previous statement.
C-c C-r Shift the region to the right. If the cursor is in the middle of a region, the lower half of the region will shift.
C-c C-s Execute a Python command.
C-c C-t Toggle shells
C-c C-u Go up one block
C-c C-v List the version of the Python mode
C-c C-w Run PyChecker
C-c ! Open the Python interactive shell
C-c # Comment the highlighted (marked) region
C-c : Check the indentation off-set
C-c < Shift the region to the left
C-c > Shift the region to the right
C-c ? Show Python mode documentation
C-c PIPE Execute the highlighted (marked) part of the current program.

Software Development#

M-x compile Will prompt for make command, then execute
M-x recompile Will repeat last compile command without prompting

Emacs