Common Emacs operations

Source: Internet
Author: User
Original address: http://publishblog.blogchina.com/blog/tb. B? DiaryID = 1960863

Common commands are as follows (note the habit of emacs. C-x means holding down Ctrl and x at the same time, and M-x means pressing Esc first and then pressing x, c-x v l: Hold down Ctrl and x at the same time, loosen Ctrl, press v and l, and C-x C-f respectively. Hold down Ctrl and Press x and f respectively, command description is case sensitive ):
1) Buffer-related. Emacs can open multiple files at the same time. Each file is a buffer.
Under X, you can use a C-mouse1 to select which buffer is currently active
C-x C-B can get a buffer list and select which buffer to open from it.
C-x C-f open a file
C-x I inserts a file content in the opened buffer.
C-x k closes the file in the Current buffer
C-x C-s Save the Current buffer
Save C-x C-w
C-x s saves all the buffer
2) screen segmentation. emacs can view multiple buffers in the same window.
C-x 2 Vertical Split current subwindow
C-x 3 Horizontal Split current subwindow
C-x 1 exclusive window space of the current window
Switch the C-x o activity subwindow to another subwindow.
3) EDIT related
Insert/overwrite mode switch
M-x overwrite-mode is used to convert insert mode and overwrite mode

Repeated operation: Numeric arguments apply to all EMACS commands. It can be used in the following categories:

  • Repeated execution of a command
  • Usage: C-u n command or M-n command

For example, C-u 4 r enters 4 r in the buffer.
C-u 4 C-u 5 Input 4 5 in the buffer (repeated numbers must be noted that there are two C-u)

Delete-deletion
C-d: delete a character from the backend.
Delete-killing (CUT)
In EMACS, the so-called killing refers to moving a file from the current buffer zone to a location called kill-ring and a variable. The file disappears in the buffer but is stored in the kill-ring and variable. EMACS can have many buffers, but only one kill-ring storage variable. That is to say, multiple buffers share one kill-ring with each other, and there is only one kill-ring. The shared killing-ring designed by EMACS is intended to allow retrieval of abandoned files, and the buffer zones can also use killing-ring to establish an interconnected pipeline. The so-called intercommunication is to give things in the buffer zone A to Party B. On the contrary, you can also give things in the buffer zone B to Party. This mode is completed through killing-ring in EMACS. Therefore, to get some files from the buffer zone A to the buffer zone B, you only need to put the files in the buffer zone A into the kill-ring. Then, the buffer zone B can retrieve the files from the shared kill-ring. In this way, you can share resources. To view the content in kill-ring, 1. after you type ''ctrl-h v'', the echo area will display: 2. enter the variable name after Describevariable. EMACS opens a window to display the variable value. The variable name you want to enter is ''kill-ring''
C-k Delete (CUT) a row
C-x C-o Delete (CUT) the blank line behind the position of the cursor

Copy and paste
To set a block, follow these steps:
1. Set the start position of the block, that is, the mark ).
2. You can use either ''ctrl-@ ''or ''ctrl-SPC'' or M-x set-mark-command to set the flag.
3. Set the block end position, that is, move the cursor to the end of the block.
The range between the mark and the point is the so-called block.
M-@ start marking area for copying
M-w: copy the current mark Region
C-w cut the current mark area to the memory
C-y paste the clipboard content in the current position
C-y M-y: if the root of the command is M-y after the command is pasted, the clipboard content can be switched to multiple M-y
C-x u undo function (as if there is no redo)

Ctrl-x Ctrl-p (mark-page)
Ctrl-x Ctrl-l (downcase-region) to lower case
Ctrl-x Ctrl-u (upcase-region) converts an area to uppercase
Meta-x fill-region
Meta-x print-region

Replace
M-x replace-string RET old string RET New string RET (no comments)
M-x query-string RET old string RET New string RET (for advice)
4) C-g cancels the entered command
5) online help
Ctrl-h c and Ctrl-h k' have similar functions. Both are looking for information related to Hotkey. The only difference between the two lies in the detailed explanation of the commands.
C-h a and C-h w allow the user to type any sub-string and find the corresponding commands. The substring typed with Ctrl-h a is not limited to the first character of the command. Ctrl-h w must start with the first word of the command. Use Ctrl-h a to give Sub-strings at any position in the command. Ctrl-h a cannot use completion, while Ctrl-h w can use completion.
C-h I active M-x info view help info
D. Run the Ctrl-h I command to enter the root of the info tree structure. In any case, type ''d' to return to this root
Department
M MenuName is directly moved to the specified Menu.
N move the node to the next node connected to the node.
P moves the node to the previous node connected to the node.
U moves the node to the node on the previous layer.

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.