<<

GNU Reference Card Motion Multiple Windows (for version 27) entity to over backward forward When two commands are shown, the second is a similar com- character tag">C-b C-f mand for a instead of a . Starting Emacs word M-b M-f delete all other windows C-x 1 C-x 5 1 line C-p C-n window, above and below C-x 2 C-x 5 2 To enter GNU Emacs 27, just its name: emacs go to line beginning (or end) C-a C-e delete this window C-x 0 C-x 5 0 sentence M-a M-e split window, side by side C-x 3 paragraph M-{ M-} scroll other window C-M- Leaving Emacs page C-x [ C-x ] switch to another window C-x o C-x 5 o sexp C-M-b C-M-f suspend Emacs (or iconify it under X) C-z select buffer in other window C-x 4 b C-x 5 b function C-M-a C-M-e Emacs permanently C-x C-c display buffer in other window C-x 4 C-o C-x 5 C-o go to buffer beginning (or end) M-< M-> find file in other window C-x 4 f C-x 5 f Files scroll to next screen C-v find file read-only in other window C-x 4 C-x 5 r scroll to previous screen M-v run in other window C-x 4 C-x 5 d scroll left C-x < find tag in other window C-x 4 . C-x 5 . read a file into Emacs C-x C-f scroll right C-x > grow window taller C-x ^ save a file back to disk C-x C-s scroll current line to center, top, bottom C-l save all files C-x s shrink window narrower C-x { goto line M-g g insert contents of another file into this buffer C-x i grow window wider C-x } goto char M-g c replace this file with the file you really want C-x C-v back to indentation M-m Formatting buffer to a specified file C-x C-w toggle read-only status of buffer C-x C-q current line (-dependent) TAB Killing and Deleting indent region (mode-dependent) C-M-\ Getting entity to backward forward indent sexp (mode-dependent) C-M-q character (delete, not kill) C-d indent region rigidly arg columns C-x TAB indent for comment M-; The help system is simple. Type C-h (or F1) and follow the di- word M-DEL M-d insert newline after point C-o rections. If you are a first- user, type C-h t for a tutorial. line (to end of) M-0 C-k C-k sentence C-x DEL M-k move rest of line vertically down C-M-o remove help window C-x 1 sexp M-- C-M-k C-M-k delete blank lines around point C-x C-o scroll help window C-M-v line with previous (with arg, next) M-^ kill region C-w delete all white space around point M-\ : show commands matching a string C-h a region to kill ring M-w put exactly one space point M-SPC describe the function a key runs C-h k kill through next occurrence of char M-z char describe a function C-h f fill paragraph M-q yank back last thing killed C-y get mode-specific information C-h m set fill column to arg C-x f replace last yank with previous kill M-y set prefix each line starts with C-x . Error Recovery Marking set face M-o Case Change abort partially typed or executing command C-g set mark here C-@ or C-SPC files lost by a system crash M-x recover-session exchange point and mark C-x C-x uppercase word M-u an unwanted change C-x u, C-_ or C-/ set mark arg words away M-@ lowercase word M-l restore a buffer to its original contents M-x revert-buffer mark paragraph M-h capitalize word M-c redraw garbaged screen C-l mark page C-x C-p uppercase region C-x C-u mark sexp C-M-@ lowercase region C-x C-l mark function C-M-h mark entire buffer C-x h The Minibuffer search forward C-s The following keys are defined in the minibuffer. search backward C-r Query Replace complete as much as possible TAB search C-M-s complete up to one word SPC interactively replace a text string M-% reverse regular expression search C-M-r complete and execute RET using regular expressions M-x query-replace-regexp show possible completions ? select previous search string M-p Valid responses in query-replace mode are select next later search string M-n fetch previous minibuffer input M-p exit incremental search RET replace this one, go on to next SPC or y fetch later minibuffer input or default M-n undo effect of last character DEL replace this one, don’t move , regexp search backward through history M-r abort current search C-g skip to next without replacing DEL or n regexp search forward through history M-s replace all remaining matches ! abort command C-g Use C-s or C-r again to repeat the search in either direction. If back up to the previous match ^ Type C-x ESC ESC to edit and repeat the last command that Emacs is still searching, C-g cancels only the part not matched. exit query-replace RET used the minibuffer. Type F10 to activate items on c 2021 Free Foundation, Inc. Permissions on back. enter recursive edit (C-M-c to exit) C-r text terminals. GNU Emacs Reference Card Regular Expressions Registers any single character except a newline . (dot) save region in register C-x r s Buffers zero or repeats * insert register contents into buffer C-x r i select another buffer C-x b one or more repeats + save value of point in register C-x r SPC list all buffers C-x C-b zero or one repeat ? jump to point saved in register C-x r j kill a buffer C-x k quote special characters \ quote regular expression special character c \c Transposing alternative (“or”) \| Keyboard Macros grouping \( ... \) transpose characters C-t shy grouping \(:? ... \) defining a keyboard C-x ( transpose words M-t explicit numbered grouping \(:NUM ... \) end keyboard macro definition C-x ) transpose lines C-x C-t same text as nth group \n execute last-defined keyboard macro C-x e transpose sexps C-M-t at word break \b append to last keyboard macro C-u C-x ( not at word break \B Spelling Check name last keyboard macro M-x name-last-kbd-macro entity match start match end insert Lisp definition in buffer M-x insert-kbd-macro check spelling of current word M-$ line ^ $ check spelling of all words in region M-x -region word \< \> check spelling of entire buffer M-x ispell-buffer symbol \_< \_> Commands Dealing with toggle on-the-fly checking M-x flyspell-mode buffer \‘ \’ class of characters match these match others eval sexp before point C-x C-e Tags explicit set [ ... ] [^ ... ] eval current defun C-M-x word-syntax character \w \W eval region M-x eval-region find a tag (a definition) M-. character with syntax c \sc \Sc read and eval minibuffer M-: find next occurrence of tag C-u M-. character with category c \cc \Cc load a Lisp from load- M-x load-library specify a new tags file M-x visit-tags-table regexp search on all files in tags table M-x tags-search International Character Sets Simple Customization run query-replace on all the files M-x tags-query-replace specify principal language C-x RET l continue last tags search or query-replace M-, show all input methods M-x list-input-methods customize variables and faces M-x customize Shells enable or disable input method C-\ Making global key bindings in Emacs Lisp (example): set coding system for next command C-x RET c (global-set-key (kbd "C-c g") ’search-forward) execute a command M-! show all coding systems M-x list-coding-systems (global-set-key (kbd "M-#") ’query-replace-regexp) execute a shell command asynchronously M-& choose preferred coding system M-x prefer-coding-system run a shell command on the region M-| filter region through a shell command C-u M-| Writing Commands start a shell in window *shell* M-x shell enter the Info documentation reader C-h i (defun command-name (args) find specified function or variable in Info C-h S Rectangles "documentation" (interactive "template") Moving within a node: copy rectangle to register C-x r r body) scroll forward SPC kill rectangle C-x r k An example: scroll reverse DEL yank rectangle C-x r y beginning of node b (defun this-line-to-top-of-window (line) open rectangle, shifting text right C-x r o "Reposition current line to top of window. Moving between nodes: blank out rectangle C-x r c With prefix argument LINE, put point on LINE." prefix each line with a string C-x r t next node n (interactive "P") previous node p (recenter (if (null line) Abbrevs move up u 0 select menu item by name m (prefix-numeric-value line)))) add global abbrev C-x a g select nth menu item by number (1–9) n add mode-local abbrev C-x a l follow cross reference (return with l) f The interactive spec says how to read arguments interac- add global expansion for this abbrev C-x a i g return to last node you saw l tively. Type C-h f interactive RET for more details. add mode-local expansion for this abbrev C-x a i l return to node d explicitly expand abbrev C-x a e go to top node of Info file t c 2021 Foundation, Inc. expand previous word dynamically M-/ go to any node by name g For GNU Emacs version 27 Designed by Stephen Gildea Other: Miscellaneous Released under the terms of the GNU General Public License version 3 run Info tutorial h or later. numeric argument C-u num look up a subject in the indices i For more Emacs documentation, and the T X source for this card, see negative argument M-- search nodes for regexp s E the Emacs distribution, or https://www.gnu.org/software/emacs quoted insert C-q char quit Info q