Emacs usage (basic operations)

Source: Internet
Author: User
Emacs uses the (Basic operation) Emacs command to press the following command button in Emacs. C key: Contorl. you can control language-independent units (characters, rows ). Press ctrl on the keyboard. M Key: indicates Meta, which is used to control the language-defined unit (... Emacs). the Command key of Emacs is as follows. C key: Contorl. you can control language-independent units (characters, rows ). Press ctrl on the keyboard. M Key: indicates the meaning of Meta, which is used to control the unit defined by language (such as words, sentences, and paragraphs ). Generally, it is the Alt key on the keyboard. Esc: one click is equivalent to M -. -: In Emacs commands, you often see the-symbol, which means to hold down the previous character. for example, C-x means to press Ctrl and then press x. Command cancellation: C-g, or press the Esc. Emacs file twice to open, store, and exit the file. Open File: C-x C-f. open a file buffer in the current window. Save the file: C-x C-s to save the current file. C-x s stores multiple buffers. Save the file as: C-x C-w. open a New farme: C-x 5 2. exit Emacs: C-x C-c. the buffer mentioned above can be understood as another space opened by Emacs for each file. in this space, you can edit files as you like, do not worry about affecting the original file. Emacs regularly saves your buffer file and names the file # file name # in the same directory (the file disappears automatically after it is stored ), so you don't have to worry that the edited content will be lost. Show all buffers: C-x C-B. select a name buffer: C-x B, and enter the name of the file in the buffer (you can directly select up and down). The default value is the previous buffer. last buffer: C-x left. next buffer: C-x right. disable Buffer: C-x k buffer name (can be directly selected up or down) move the cursor to control the cursor when editing the text. Upper: C-p (previous ). below: C-n (next ). left: C-B (back ). right: C-f (forward ). move to the start of the File: M-<. move to the end of the File: M->. move to the beginning of the row: C-. move to the end of the row: C-e (end ). move one word forward: M-f. move one word backward: M-B. move a sentence forward: M-. move a sentence backward: M-e. scroll down a screen: C-v (view ). scroll up one screen: M-v. place the current row in the middle of the screen: C-l. place C-l at the beginning of the screen twice, and C-l at the end of the screen three times. File editing deletes, copies, and pastes text. (1) set markC-Space or C-@ (C-Shift-2 ). C-Space is obviously more convenient, but you need to modify the shortcut keys of the input method to avoid conflicts. (2) copy & paste copy: First set mark, then M-w, the characters from mark to cursor are copied to buffer. Paste: C-y. (3) delete the character from the cursor to the end of the line: C-k (kill ). delete the character from the cursor to the end of the sentence: M-k. remove: first set mark, then C-w, remove the character from mark to cursor. Delete the character before the cursor: backspace (the one above the carriage return key ). delete the current character: C-d (delete ). delete a word before the cursor: M-backspace. delete a word after the cursor: M-d. copy the last remove text: C-y (yank ). summon text removed before: M-y. note: use it after C-y is used. (4) Select All: C-x h. (5) undo: C-x u (undo ). For text search, Emacs can search strings forward and backward. the search command is progressive (incremental), that is, the search is synchronized with the input. If no character is entered, Emacs will start searching. Search forward: C-r. search backward: C-s. note: When searching, you can press C-s/r to view the next position/previous position. C-g cancels the search and returns to the initial search cursor position; End the search, and the cursor stays on the search results. There are two ways to redirect text: (1) M-g-> LineNumber (2) M-x goto-line-> Enter-> LineNumber. Emacs has many advantages over multiple windows, multiple files can be displayed simultaneously on one screen. Add window: C-x 2. the newly added window is the current file. Close the window outside the current window: C-x 1. scroll down the window below: C-M-v scroll down the window below (up): C-M-Shift-v. traversal window: C-x o. open the file C-x 4 C-f in a new window. repeated commands: the C-u numeric command. Repeat the command as the number given. More help Emacs provides too many functions. For more information, see the Help document. The basic usage is C-h.Help document information: C-h ?. A brief description of the command: C-h c. add the command to be queried. For example, C-h c C-p . Command description: C-h k. explains a function: C-h f. show Emacs variable document: C-h v. search related commands: C-h. enter a keyword. Emacs displays all related commands.
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.