This document provides a cheat sheet for keyboard shortcuts and commands in the Emacs text editor. It includes sections on navigation, deleting/cutting text, searching/replacing text, files and buffers, keyboard help commands, and some longer commands for additional functionality like compiling code and customizing Emacs. Key combinations with Control (C-) and Meta/Alt (M-) allow for movement by characters, words, lines, sentences and more along with common editing operations.
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 ratings0% found this document useful (0 votes)
87 views1 page
Emacs Cheatsheet
This document provides a cheat sheet for keyboard shortcuts and commands in the Emacs text editor. It includes sections on navigation, deleting/cutting text, searching/replacing text, files and buffers, keyboard help commands, and some longer commands for additional functionality like compiling code and customizing Emacs. Key combinations with Control (C-) and Meta/Alt (M-) allow for movement by characters, words, lines, sentences and more along with common editing operations.
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/ 1
98-172 : Great Practical Ideas for Computer Scientists
Emacs cheat sheet
Navigation Operation Move Delete Amount forward backward forward backward Characters C-f C-b C-d DEL Words M-f M-b M-d M-DEL or C-DEL Lines C-n C-p No bindings Line end/start C-e C-a C-k C-SPC C-a C-w Sentences M-a M-e M-k C-x DEL Expressions C-M-f C-M-b C-M-k Paragraphs M-} M-{ No bindings Buer end/start M-< M-> Page down/up C-v M-v Other navigation commands M-g g n Jump to line n C-x C-x Swap mark and point (see Terminology section, below). Terminology C-, control The control key. M-, meta The alt key on most PC keyboards; on Macs, usually the option key. kill, yank cut and paste respectively. ring A list of saved values which can be iterated through. Eg. the kill ring, which saves killed text for yanking. point The current cursor location. mark A saved location in a buer, set with C-SPC. region The text between the point and mark. prex argument A way to modify commands behavior using a prex key combination. Behavior depends on the command being modied. Most commonly, it repeats the command a spec- ied number of times. mode A buers modes add special behavior to it; for example, Python-mode adds syntax hilighting and useful commands for Python code. SPC The space key. DEL The delete or backspace key. RET The enter or return key. Miscellanea C-/ Undo. Also C- , C-x u, and M-x undo. C-u n Numeric prex argument; usually, repeats a subsequent com- mand n times. C-g Cancel or abort a command. C-x C-c Quit emacs. TAB Mode-dependent; usually auto-indents current line. M-x NAME Run the named command. M-: EXPR Evaluate a lisp expression (for advanced users). Files and buers C-x C-f Open le by name. C-x C-s Save le. C-x C-w Write le with new name. C-x b Switch buer by name. C-x C-b List buers. Hit enter on a buer to switch to it. Killing (cutting) and yanking (pasting) C-y Yank (paste) most recently killed (cut/copied) text. M-y After C-y, yank next-recently-killed. Repeat to continue. C-SPC Mark current location. C-w Kill current region. M-w Copy the current region without killing it. Search and replace C-s Search forward. Repeat (or use after C-r) for next match. C-r Search backward. Repeat (or use after C-s) for previous match. C-M-s Search forward using regexp matching. C-M-r Search backard using regexp matching. M-x % Interactive string replacement. Also M-x query-replace. The regexp version is M-x query-replace-regexp. Help C-h C-h Help about help. C-h c KEY Name of the function associated with a key combination. C-h k KEY Help for the function associated with a key combination. C-h f NAME Help for a particular function. C-h a WORD Help for all functions matching a particular word. C-h b Display key bindings. C-h m Help for the current modes. C-h r The emacs manual. Long commands M-x iswitchb-mode Makes switching buers a lot nicer. M-x ansi-term Opens an emulated terminal inside emacs. M-x compile Prompts for a command to run to compile code. M-x menu-bar-mode Toggles display of the menu bar. M-x scroll-bar-mode and M-x tool-bar-mode behave analogously. M-x customize A special mode that makes customizing emacs much easier. See also customize-group. One useful group is iswitchb. Resources (other than google.com) http://www.gnu.org/software/emacs/manual/emacs.html The emacs manual, online. http://www.stackoverflow.com/ Good general-purpose programming questions site. #emacs on irc.freenode.org An IRC channel for all things emacs. http://www.emacswiki.org/ A wiki dedicated to emacs.