Emacs

Emacs Cheatsheet #

Emacs is a highly customizable and extensible text editor. It is known for its powerful features and extensive keyboard shortcuts, making it suitable for a wide range of tasks.

Basic Navigation #

Command/OptionExampleDescription
C-fC-fMove cursor forward by one character
C-bC-bMove cursor backward by one character
C-nC-nMove cursor to the next line
C-pC-pMove cursor to the previous line
M-fM-fMove cursor forward by one word
M-bM-bMove cursor backward by one word
C-aC-aMove cursor to the beginning of the line
C-eC-eMove cursor to the end of the line
M-<M-<Move cursor to the beginning of the buffer
M->M->Move cursor to the end of the buffer

Editing Text #

Command/OptionExampleDescription
C-dC-dDelete the character under the cursor
M-dM-dDelete the word forward
C-kC-kKill (cut) text from the cursor to the end of the line
C-yC-yYank (paste) the previously killed text
M-yM-yCycle through the killed texts
C-x C-sC-x C-sSave the current buffer
C-x C-cC-x C-cExit Emacs
C-/ or C-x uC-/ or C-x uUndo the last action
C-spaceC-spaceSet the mark (start selection)

Search and Replace #

Command/OptionExampleDescription
C-sC-s search_termSearch forward for “search_term”
C-rC-r search_termSearch backward for “search_term”
M-%M-% old_text RET new_text RETReplace “old_text” with “new_text” in the buffer

File Operations #

Command/OptionExampleDescription
C-x C-fC-x C-f filenameOpen or create a file named “filename”
C-x C-wC-x C-w newfileSave the current buffer as “newfile”
C-x kC-x kKill (close) the current buffer
C-x bC-x b buffer_nameSwitch to the buffer named “buffer_name”

Window Management #

Command/OptionExampleDescription
C-x 2C-x 2Split the window horizontally
C-x 3C-x 3Split the window vertically
C-x 1C-x 1Delete other windows, keeping only the current one
C-x oC-x oSwitch to the other window

Buffer Management #

Command/OptionExampleDescription
C-x bC-x b buffer_nameSwitch to the buffer named “buffer_name”
C-x C-bC-x C-bList all buffers
C-x kC-x k buffer_nameKill (close) the buffer named “buffer_name”

Customization and Help #

Command/OptionExampleDescription
M-xM-x commandExecute a command by name
C-h tC-h tOpen the Emacs tutorial
C-h fC-h f function_nameDisplay documentation for “function_name”
C-h vC-h v variable_nameDisplay documentation for “variable_name”
M-x customizeM-x customizeOpen the customization interface

Advanced Commands #

Command/OptionExampleDescription
M-x shellM-x shellOpen a shell within Emacs
M-x termM-x termOpen a terminal emulator within Emacs
M-x magitM-x magitOpen the Magit interface for Git version control

This cheatsheet covers the essential Emacs commands and options to help you navigate, edit, and manage text efficiently in Emacs.

Emacs

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.