Emacs Commands List (by Gary M. Zoppetti) ===================== (C = Control, M = Meta = ESC) File Handling ---- -------- C-x C-f visit file C-x C-r visit file read-only C-x 4 f visit file in another window C-x 5 f visit file in another frame C-x C-v visit alternate file C-x C-q check visited file in or out or change read-only flag C-x v v check visited file in or out C-x v u revert buffer and the file to the last checked in version C-x v c remove the last-entered change from the master for the visited file -- this undoes your last check-in C-x v i register the visited file for version control C-x C-s save current buffer C-x s save all modified buffers C-x C-w write file C-x i insert file @ point C-x C-b list buffers C-x b select or create buffer C-x k kill buffer M-x rename-buffer rename buffer M-x write-region writes region to file M-x append-to-file append region to file M-x print-buffer print buffer C-x C-d print brief directory listing C-u C-x C-d print verbose directory listing M-x cd change default directory Editing ------- C-SPC set mark C-x C-x exchange point & mark C-u C-SPC move through mark ring C-d delete next character M-d kill word M-DEL kill word backwards M-k kill sentence C-x DEL kill back to beginning of sentence C-k kill rest of line C-w kill region C-M-w append next kill M-w save region without killing (C-y retrieves) M-x kill-rectangle kill rectangle M-x yank-rectangle yank rectangle C-y yank last killed M-y replace re-inserted killed text w/previous kill M-x view-register RET R Display a description of what register R contains C-x r SPC R Save position of point in register R C-x r j R Jump to the position saved in register R C-x r s R copy region to register R C-x r i R insert text from register R etags FILES create a tags table file named TAGS M-. TAG Find first definition of TAG C-u M-. Find next alternate def. of last tag specified C-u - M-. Go back to previous tag found C-M-. PATTERN Find a tag whose name matches PATTERN C-u C-M-. Find next tag whose name matches the last pattern used C-x 4 . TAG Find first def. of TAG & display in another window C-x 5 . TAG Find first def. of TAG & display in another frame M-* Pop back to where you prev. invoked `M-.' and friends C-x a append region to buffer M-x insert-buffer insert buffer C-x r m RET Set the bookmark for the visited file, at point C-x r m BKMRK RET Set the bookmark named BKMRK at point C-x r b BKMRK RET Jump to the bookmark named BKMRK C-x r l List all bookmarks M-x bookmark-save Save current bookmark values in default bookmark file Search/Replace -------------- C-s incremental search forward (RET terminates) C-s C-s incremental search forward for last string C-r incremental search backward C-r C-r incremental search backward for last string M-p, M-n move through search ring C-s RET non-incremental search C-r RET non-incremental search backward C-M-s incremental search for a regexp forward C-M-r incremental search for a regexp backward C-M-s RET non-incremental search for a regexp forward C-M-r RET non-incremental search for a regexp backward M-x replace-string unconditional replace M-% query replace ("y" replaces, "n" skips, ESC exits) Positioning ----------- M-< beginning of buffer M-> end of buffer C-v scroll forward M-v scroll backward C-a move to the beginning of line C-e move to the end of line C-f forward character C-b backward character M-f forward word M-b backward word C-n next line C-p previous line M-a move back to beginning of sentence M-e move forward to end of sentence C-x < scroll left C-x > scroll right M-r move to left margin, vert. centered in window C-l recenter screen @ point M-x what-line print line # of point M-x what-page print page # & line # of point C-x = print character position of point C-q C-l insert page break C-x l count lines in this page Programming ----------- M-x compile run compiler C-x ` visit next error of compile M-x (MODE)-mode select major mode (C, C++, Text) M-C-a Move to beginning of current or preceding defun M-C-e Move to end of current or following defun M-a Move to beginning of innermost statement M-e Move to end of innermost statement M-C-b Move backward over one block M-C-f Move forward over one block C-M-h Put region around whole current or following defun C-x ( start definition of a keyboard macro C-x ) end definition of a keyboard macro C-x e execute the most recent keyboard macro M-x name-last-kbd-macro name the most recently defined keyboard macro C-x C-k edit a previously defined keyboard macro Debugging --------- M-x gdb Enter GNU debugger run start program break FUNCTION set breakpoint at entry to FUNCTION clear FUNCTION remove breakpoint at FUNCTION step continue running (follow function calls) next continue running (do not follow function calls) print EXP print value of EXP Windowing --------- C-x 0 kill window C-x 1 delete all but selected window C-x 2 split window vertically C-x 5 split window horizontally C-x o select other window (cyclic) C-x 4 b select buffer in another window C-x 5 b select buffer in another frame C-x 5 0 kill frame C-x ^ make selected window taller (shorter) C-x } make selected window wider (narrower) Miscellaneous ------------- C-x C-c quit Emacs C-g quit minibuffer C-x u undo M-(integer) specify repetition factor C-u (integer) specify repetition factor C-u (command) repeat command 4 times M-x shell run shell with Emacs buffer M-! run shell command M-x spell-buffer check & correct spelling of each word in buffer M-q fill current paragraph (right justify with ESC-N) M-g fill each paragraph in region M-s center a line C-x f set the fill column Indentation ----------- M-x edit-tab-stops set new tab stops C-M-\ indent region M-i indent from point to next tab stop C-x TAB shift block of lines right or left C-M-q re-indent lines in list Help ---- C-h a REGEXP RET display list of commands whose names match REGEXP C-h b display a table of all key bindings in effect now, in this order: minor mode bindings, major mode bindings, and global bindings C-h c KEY print the name of the command that KEY runs C-h f FUNCTION RET display documentation on the Lisp function FUNCTION C-h i run Info C-h k KEY display name and documentation of command KEY runs C-h m display documentation of the current major mode C-h n display documentation of Emacs changes C-h v VAR RET display the documentation of the Lisp variable VAR C-h w COMMAND RET print which keys run the command named COMMAND C-h C-f FUNCTION RET enter Info and go to node documenting FUNCTION C-h C-k KEY enter Info and go to node where key sequence KEY is documented Variables --------- M-x describe-variable print value & documentation of variable M-x set-variable change value of variable Dired ----- C-x d enter Dired C-x 4 d enter Dired in another window C-x 5 d enter Dired in another frame g update Dired listing n next filename p previous filename d flag file for deletion u remove deletion flag x delete files flagged for deletion # flag auto-save files for deletion f visit file o visit file in other window c copy file r rename file v view file (q quits)