51 insanely useful Emacs shortcuts

Source: Internet
Author: User

Intimate knowledge of your code editor is required to be competent and productive developer. here is a list of shortcuts anyone on the path to becoming an Emacs guru shoshould be familiar. this shortcut reference card covers mostly intermediate and advanced
Shortcuts for GNU Emacs (most of them will work with xemacs as well .) I learned some great new shortcuts while making this cheat sheet; I hope they will be helpful to grokcode's readers as well.

Help

M-x describe-bindings show a list of all the current key bindings. This shows you all available Emacs shortcuts and the function invoked by the specified cut.

F1 F type A function name and get a short description of what it does.

F1 a find apropos commands. entering a search term will give you a list of commands and key bindings containing the search term. very useful if you are looking for something but don't know the exact command.

Windows & Buffers

C-x O switch to next window

C-x B switch buffers. The default is to switch to the most recent buffer before your current one. Tab tab will give a buffer Completion list.

C-x C-B list all open buffers. This list is called the 'buffer ring '.

C-x K kill the current buffer.

Searching

M-% interactive string find and replace.

C-r string SEARCH backwards.

C-u C-s regular expression search.

M-x find-grep-Dired search a directory recursively for all files that contain a regular expression.

 Navigation

C-a move to the beginning of the line.

C-e move to the end of the line.

M-x goto-line or
M-g goto the indicated line.

M-> moves to end of buffer.

M-<moves to start of buffer.

 Regions

C-space set the Mark. This is a marker for the beginning of a region. Moving the cursor to another position will set the end of the region, called the 'point '.

C-x H select all. Create a region containing the whole buffer.

C-x switch the mark and the point.

M-H set the region to the current paragraph

 Copy & Paste

M-W copy the selected region to the clipboard.

C-W cut the selected region and put the text in the clipboard.

C-k cut from the cursor to the end of the line, putting the text in the clipboard.

C-y paste/yank the most recent text in the clipboard.

 Formatting & spell checking

M-U uppercase word.

M-L lowercase word.

M-$ check spelling of current word.

M-x ispell-buffer check spelling of current buffer.

M-Q reflow paragraph. When writing text, this will fix up line breaks in the paragraph.

Shft-Mouse 1 change font size.

Coding

C-c comment out region. When using a minor mode that supports it. Most minor modes for programming extends ages do.

M-^ join this line with the previous line; Removes the newline between the two lines.

M-x shell start a new shell within Emacs.

M -! Execute a shell command.

M-x hexl-mode open a buffer in hexadecimal mode.

 Macros

C-X (start macro definition.

C-x) End of macro definition.

C-x e execute last Defined Macro.

M-n c-x e execute last Defined Macro n times.

 Emacs LISP

M-: run an Emacs lisp expression in the mini-buffer.

M-x ielm run an interactive Emacs lisp interpretor. For an introduction to Emacs lisp, have a look at emergency elisp.

 Miscellaneous

C-x I insert the contents of a file at the cursor position.

C-x C-V reload file from disk.

C-/undo.

C-G quit the Command currently in the mini-buffer. Useful if you mistype a shortcut and want to start over.

C-X c-c quit Emacs.

 Slacking off

M-x zone start zoning out. After a short idle time, the text in the buffers will go crazy. Useful for keeping you on your toes.

M-x zone-leave-me-alone stop zoning out.

M-x Tetris play Tetris.

M-x doctor get psychoanalyized by an AI.

M-x Hanoi towers of Hanoi.

Source:Http://grokcode.com/207/51-insanely-useful-emacs-shortcuts/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.