Emacs Shortcut Keys

Source: Internet
Author: User
Tags save file

C = Control
M = Meta = Alt | Esc
Del = Backspace

Basic shortcut keys
C-x c-f "Find" file, i.e. open/new file in buffer
C-x c-s Save File
C-x c-w Save as file with a different file name
C-x C-v Close the current buffer file and open a new file
C-x I insert a file at the current cursor
C-x b New/Toggle Buffer
C-x c-b Display buffer list
C-x k Close the current buffer
C-z suspend Emacs
C-x C-c Close Emacs

Cursor Movement Basic shortcut key (Basic movement)
C-f after a character
C-b previous character
C-p Previous Line
C-n Next Line
A word after m-f
M-b a previous word
C-a beginning
C-E End of Line
C-v down one page
M-v up one page
m-< to the beginning of the file
M-> to end of file

Editor (Editint)
M-n repeated execution of a command n times
C-u repeated execution of a command 4 times
C-u N repeated execution of a command n times
C-d a character after deleting (delete)
m-d Delete a word after
Del deletes the previous character
M-del Delete a previous word
C-k Remove (Kill) a row

C-space Setting the start tag (for example, marking the area)
[Email protected] function as above, for c-space by the operating system interception situation
C-w removing (Kill) The contents of a marked area
M-w Copy the contents of a marked area
C-y recall (Yank) Copy/Remove area/row
M-y recall earlier content (loops within the kill buffer)
C-x c-x swapping cursors and markers

C-T swapping two-character positions
M-t exchanging two words in a position
C-x C-t Exchange two lines of position
M-u the letters from the cursor position to the end of the word into uppercase
M-l is the opposite of m-u.
M-c to capitalize the first letter of a word starting at the cursor position

Important shortcut keys (Important)
C-g stop currently running/entering commands
c-x u undo Previous Command
M-x Revert-buffer RETURN (according to this input) undo all changes since the last disk
M-x recover-file return from automatic disk File recovery
M-x recover-session return If you have edited several files, use this to restore

Online Help (ONLINE-HELP)
C-h c commands to display shortcut key bindings
C-h k shows the shortcut key Binding command and its role
C-h L display the last 100 typed content
C-h W shows which shortcut keys The command is bound to
C-h F Display Function functions
C-h v shows the meaning and value of the variable
C-h b Displays all available shortcut keys for the current buffer
C-h T Open Emacs Tutorial
c-h I open info reader
C-h c-f display Emacs FAQ
C-h p Display the information of the native Elisp package

Search/replace (seach/replace)
C-s Backward Search
C-r Forward Search
C-g back to the location before the search starts (if you are still in search mode)
m-% Query and replace (query replace)

Space or y replaces the current match
del or n do not replace the current match
. Just replace the current match and exit (replace)
, replace and pause (press space or Y to continue)
! Replace all of the following matches
^ Back to previous match location
Return or Q exit substitution

Search/replace using regular expressions (Regular expression)
Symbols that can be used in regular expressions:
^ Beginning of the line
$ End of line
. Single character
. * Any number of characters (including none)
\< the beginning of a word
\> Word End
[] Any character in parentheses (e.g. [A-z] denotes all lowercase letters)

M c-s RETURN using regular expressions to search backwards
M c-r RETURN using regular expressions to search forward
C-s Incremental Search
C-s Repeat Incremental Search
C-r Forward Incremental Search
C-r Repeat forward Incremental search
M-x query-replace-regexp using regular expressions to search for and replace

Windows command (Window Commands)
C-x 2 Horizontal Split pane
C-x 3 Vertical Split pane
C-x o Switch to other panes
C-x 0 Closing panes
C-x 1 Close all panes except the cursor pane
c-x ^ Enlarge Pane
M-x Shrink-window shrinking panes
M c-v Scrolling the contents of other panes
C-x 4 F Open file in other panes
C-x 4 0 Close the current buffer and panes
C-x 5 2 new Window (frame)
C-x 5 F Open a file in a new window
C-x 5 o switch to another window
C-x 5 0 Close the current window

Bookmark command (bookmark commands)
C-x r m creating bookmarks at the cursor's current position
C-x r b go to bookmarks
M-x bookmark-rename Renaming bookmarks
M-x bookmark-delete Deleting bookmarks
M-x Bookmark-save Saving bookmarks
C-x r L List Bookmark list

D Mark Pending Delete
Del Undelete Tag
X Delete tagged bookmarks
R Rename
s save all bookmarks in list
F go to the location where the current bookmark is pointing
M marks open in multiple windows
V Displays the bookmarked bookmark (or the bookmark at the cursor's current position)
T toggles whether the path list is displayed
W Displays the current file path
Q Exit Bookmark List

M-x bookmark-write to export all bookmarks to the specified file
M-x bookmark-load import bookmarks from a specified file

Shell
M-x Shell Open Shell mode
C-c c-c similar to UNIX c-c (stop running programs)
c-d Delete a character after the cursor
C-c c-d Send EOF
C-c c-z Suspend program (C-z under Unix)
M-p Show Previous command
M-n show the latter command

DIRectory EDitor (dired)
C-x D Open dired
C (uppercase C) copy
D Mark Pending Delete
D Delete Now
E or F Open file or directory
G Refresh current Directory
G Change file owning group (CHGRP)
K Delete a row from the list on the screen (not really deleted)
M marked with *
n cursor moves to the next line
o Open the file in another pane and move the cursor
C-o open a file in another pane without moving the cursor
P Print File
Q Exit dired
Q Replace in tagged file
R Renaming files
U Remove Tag
V Display file contents
x delete file with D tag
Z Compress/Unzip files
M-del Remove tags (default to all types of tags)
~ Mark backup file (file with filename ~) to wait for deletion
# tag AutoSave file (file name shaped like #name#) waiting to be deleted
* * Mark All folders with * (remove marks with c-u */n)
= compares the current file and the tag file (using the [email protected] tag instead of the dired m tag)
m-= Compare the current file to its backup
! Apply shell commands to the current file
M-} Move cursor to next file marked with * or D
m-{move cursor to first a file marked with a * or D
% d use regular expression to mark files for deletion
% m using regular expressions to mark files as *
+ New Folder
> Move the cursor to the next folder
< move cursor to previous folder
S toggle sort mode (by file name/date)

Perhaps it would be appropriate to put this order in this category:
M-x Speedbar Open a stand-alone Directory display window

Telnet
M-x telnet to open telnet mode
c-d after deleting a character or sending EOF
C-c c-c stop running programs (similar to c-c under Unix)
C-c c-d Send EOF
C-c C-o clears the output from the last command
C-c C-z suspending a running command
C-c C-u Remove Previous line
M-p Show Previous command

Text
Can only be used in text mode
M-s to center the current row
M-s to center the current paragraph
M-x center-region to center the selected area

Macro command (Macro-commands)
C-x (Start defining macros
C-X) End Definition macro
C-x e run a recently defined macro
M-n C-x e Run the recently defined macro n times
M-x Name-last-kbd-macro named for the recently defined macro (for saving)
M-x Insert-kbd-macro to save a named macro to a file
M-x load-file Loading macros

Programming (programming)
M c-\ automatically indents the area between the cursor and the marker
M-M moves the cursor to the beginning of the first (non-whitespace) character
m-^ the current line at the end of the previous line
m; Add indented and formatted annotations
C, C + + and Java mode
M-A move cursor to the beginning of the declaration
M-E move cursor to end of declaration
M c-a Move the cursor to the beginning of the function
M C-E Move the cursor to the end of the function
C-c RETURN moves the cursor to the beginning of the function and marks it at the end
C-c c-q indents the entire function according to indentation style
C-c c-a Toggle Wrap function
C-c c-d One-time deletion of a string of spaces after the cursor (greedy delete)

In order to implement some of the following techniques, you need to run "etags" in the directory where the source code is saved.
*.C *.h *.cpp "(or other extension of the source code)
M-. (dot) Search label
M-x tags-search ENTER Search All tags (using regular expressions)
M, (comma) jumps to the next match in Tags-search
M-x tags-query-replace Replace text in all files that have been tagged

GDB (Debugger)
M-x GDB opens gdb in the other pane

Versioning (version control)
C-x v D displays all registered files in the current directory (show all registered file in this dir)
C-x v = Compare differences between different versions (show diff between versions)
C-x v u remove changes since last commit (remove all changes since checkin)
C-x V ~ Display a version in a different pane (show certain version in different window)
C-x v L Print Log
C-x v i tag files waiting to add versioning (mark file for version control add)
C-x v H Add a version control header to a file (Insert version-Control header into file)
C-x v R Gets the named snapshot (check out named snapshot)
C-x v S creates a named snapshot (create named snapshot)
C-x v A creates a GNU-style change log (create Changelog file in Gnu-style)

Emacs Shortcut Keys

Related Article

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.