Emacs Quick Guide (Emacs Tutorial)

xiaoxiao2021-03-06  45

It is recommended to save the following document, then open with Emacs, and practice while watching.

------------------------------------------

You are reading the Emacs Quick Guide (Emacs Tutorial). Please see the page for copy conditions. Copyright (C) 1985, 1996, 1998, 2001, 2002 Free Software Foundation.

The EMACS command typically contains the Control key (sometimes in Ctrl or CTL) or the META key (sometimes indicated by an EDIT or Alt). In order to avoid writing its full name every time, we will use the abbreviations:

C- Sell to press the Control button when you type characters. Therefore, C-F is: Press and hold the Control button and type f. M- means holding down the META or EDIT or ALT key when typing characters. If there is no META, an EDIT or ALT key, you can use "Step of pressing the ESC to release, and then type step" is used as an alternative. Let us express the ESC key.

Important memo: To exit Emacs sessions (SESSION), type C-X C-C (two characters). The ">>" character in the left border is a prompt to let you try the commands used. For example: <> [Middle of Page Left Blank for DidActic Purposes. Text Continues Below] >> Type C-V (View Next Screen) to move to the next screen. (Try to see, type the character V, hold down the Control key) From now, you should do this action at each time you read.

It should be noted that when you move from one screen to another, there will be two rows of rows; this is to provide some continuity, so you can read text.

What you need to know how to move in the text. You already know that you can move a screen forward in C-V. To move a screen back, type M-V (hold down the META button, type V, or type V if you do not have META, EDIT, or Alt keys).

>> Try to type M-V and then C-V and continue several times.

[Now you can move the C-V command to the "translation" section behind to achieve the translation related matters in this article; then return here with the m-v command. 】

* Summary -------------------

The following command is quite useful when browsing the screen: [We now use "screen" to represent the "area of ​​display file content", because it is currently in the single-pane display status in Emacs, if it is in multi-pane In the state of the commands, the commands are described in "Works in Work". For the introduction of the pane, see the Windows section. 】

C-V moves forward a screen / pane M-V moving a screen / pane C-L to clear the screen / pane, re-displays all text, and the location where the cursor is located in the center of the screen / pane. (Is Control-L instead of Control-1)

>> Find the position of the cursor and pay attention to why. Then type C-L. Once again, the position of the cursor is found, confirm that the same text is now near it. If your terminal has a PageUp and a PageDN key, you can also use them to move in units, but use C-V and M-V to be more efficient.

* Basic Cursor Control ----------------------------------------- -

The screen to the screen is very useful, but how do you move to a specific location in the screen in the screen?

There are several ways to do. You can use the arrow keys, but put your hand in the standard [keyboard] position, and use commands C-P, C-B, C-F and C-N will be more efficient. These characters and four arrow keys [function] are equal, as shown below:

The front line C-P :: backward C-B .... Current cursor position .... move forward C-F :: After a line C-N

>> Move the cursor to the center of the graph in C-N or C-P. Type C-L will see the entire graph display on the center of the screen.

You will find that the meaning representing the letters is easy to remember: P Represents previous, n to NEXT, B represents the backward, and F represents Forward. You will "always" use these cursors to move commands.

>> Move the cursor to this line as a few times.

>> Move from C-F to this line several times, then move back in C-P. See what the C-P movement is when the cursor is in the center of the Bank.

Each text line is ended as a newline character, which is used to separate from each other. The last line in your file should have a newline to end (but Emacs does not necessarily need it to edit the file).

>> Try to type C-B in the place where the row is started. The result should be moved to the last side of the previous row. This is because it passes the newline characters when it moves back.

C-F can also pass the NewLine characters like C-B. [NewLine characters are "invisible", in the editor, you can't see it, here just tell you: Going forward again, then the cursor will run to the front line (if there is a front line) After the end of the road, then the cursor will run to the next line (if there is a line of line). "Crossing Newline characters" will let the cursor go to another line. 】

>> Multiple C-B, you feel the cursor. Then press C-F to the tail of this line several times. Pressing C-F again to move to the next line.

When you move the cursor above or below the screen, the text outside the boundary shifts into the screen. This is called "rolling". It allows Emacs to move the cursor to any particular location in the text, and (cursor) will not run out of the screen.

>> Try to take the cursor under the screen with C-N, then look at what happened.

If a character moves too slowly, you can move one word one word. M-F (META-F) moves a word forward, M-B moves a word behind. [For Chinese, it is the way to move to the next or next punctuation. 】

>> Type some M-F and M-B.

When you are in the middle of a word, M-F will move to the tail of this word. When you are blank between the words and the words, M-F will move to the next word of the next word. The effect of M-B is similar, but the direction is different.

>> Press several times M-F and M-B, middle incisions, some C-F and C-B, so you can observe that M-F and M-B in different positions of "bit in the inter-word inter-word or characters", exhibited behavior. Please note the similarities between C-F, C-B and M-F, M-B. The situation of "often" is: META characters are used as an operation related to "the unit (words, sentences, paragraphs)" defined by language, and the Control character is "basic" "basic" with you editable Unit (characters or lines, etc.) ".

This similarity is equally applicable between "line and sentence": C-A and C-E move the cursor to the beginning and end of "one line", while M-A and M-E move the cursor to the beginning and end of "a sentence".

>> Try to press twice C-A and then press twice C-E. Try to press twice M-A and press twice M-E.

Look at why the duplicate C-A command will have no effect, while repeated m-a commands continue to move to the next sentence. Although this is not a complete class, it is very natural.

The position of the cursor in the text can also be called "Point". Simply, that is: the cursor exhibits the text location of "point" in the screen.

Here is some simple "cursor-moving operation", including the "word and sentence" mobile command:

C-f moves a character C-B back to move a character

M-F moves forward a word [Chinese is moving to the next punctuation] m-b back moving a word [Chinese is moving to the previous punctuation]

C-N moves to the next line C-P moves to the previous line

C-A moves to the head C-E moved to the end

M-A moves back to the sentence M-E moved to the end of the sentence

>> Exercise several times of these orders. These are the most commonly used commands.

There are also two important cursor-motion commands, M - <(Meta Less-Than), moved to the beginning of the text, and M->-Than, moving to the final.

At most of the terminal, "<" is above the COMMA, so you must use the Shift key to type. On these terminals, you must use the Shift key to type m- <; do not use the Shift key, you turn into type M-COMMA.

>> Try M- <, moved to the beginning of this fast guide. Then use C-V to return here again.

>> Try M-> now, move to the final guide. Then repeatedly use M-V to return here.

If your terminal has a direction key, you can also use the arrow keys to move the cursor. We have three reasons. It is recommended that you learn C-B, C-F, C-N, and C-P: (1) any terminals can be used. (2) Once you are quite skilled in using Emacs, you will find these Control characters, which is 使用 使用 使用 使用 区 区 区 区 (键 键.......... (.. (3) Once you use these Control character commands to become habits, you can easily learn other advanced cursor action commands.

Most of the EMACS commands accept digital parameters; for most of the commands, its role is to specify the number of repetitions. The number of repetitions you want to specify a command is: Type C-U first, then type the number of repetitions before you type instructions. If you have a META (or Edit or Alt) key, you have another alternative to enter a digital parameter: Press and hold the META button when you enter this number. We recommend that you learn C-U methods because it can be used in any terminal. This digital parameter is also called "word parameters" because you type it before this parameter acts. For example, C-U 8 C-F moves 8 characters forward.

>> Try to use C-N or C-P with a number parameter, only one command moves the cursor to the vicinity of this line.

Most of the commands use digital parameters as their repetition, but some commands are used as other purposes. There are several commands (currently you have not learned) as a flag-appear as a word of the first parameter, regardless of why, they make this order make some different things.

C-V and M-V are an exception of another class. When a parameter is given, they are rolled out "The specified number of rows (in behavioral units), rather than" screen ". For example, C-U 8 C-V will display the screen roller 8 line.

>> Now try to type C-U 8 C-V.

This command should have moved the screen up to 8 lines up. If you want to get it down again, you can give a given parameter when you perform M-V.

If you are using the X window system, there should be a rectangular area called "Volume Shaft" on the left hand side of the EMACS window. You can use the mouse to press the scroll shaft to scroll.

>> Try to press the intermediate button on the "rolling axis inner inner area". This should be rolled into the location determined by the place where you press it.

>> When pressed in the middle, try to move the mouse up and down. You will see the text up and down as you move the mouse.

* When Emacs is in a daze (When Emacs is Hung) ------------------------- -

If Emacs stops responding to your command, you can type C-G to securely stop it. You can also use C-G to stop performing an overnaughter command.

You can also use C-G to cancel digital parameters or you don't want to complete the command.

>> Type the C-U 100 to set the number parameters of a 100, and then type C-G. Type C-F now. It should only move one character because you have canceled the parameters in C-G.

If you are not carefully type one, you can C-G to cancel it.

* Incompatible command (Disabled Commands) -------------------------------------

Some Emacs commands are "invalidated", so beginners will not use them unexpectedly.

If you type an invalid command, Emacs displays a message, indicating what this command is, and ask if you want to continue, then execute this command.

If you really want to try this command, type blank when you ask you when emacs asks you. In general, if you don't want to perform this invalid command, please answer it with "N".

>> Type C-X C-L (this is an invalid command) and then type N to answer questions.

* WINDOWS -------------------

Emacs can have several panes, each showing its own text. We will explain how to use multiple panes later. Now we want to explain how to remove excess pane, then return to the basic single-pane editing. It is very simple: C-X 1 One Window (ie, remove all other panes).

That is a number 1 followed by Control-X. C-X 1 expands the pane containing the cursor to the entire screen. It removes all other panes.

>> Move the cursor to the Bank and type C-U 0 C-L. >> Type Control-Hk CONTROL-F. Take a look at this pane in a new pane appears (to display text files about the Control-F command), how it is shrinking.

>> Type C-X 1 to disappear with the list of documents.

This command is not like the command you have learned, it includes two characters. It starts with character control-x. A whole series of commands begins with Control-X; there are many of them related to "pane, file, temporary area, and related things". These commands have 2, 3 or 4 characters long.

* Insert and deletion --------------------------------------------------------

If you want to insert a text, type it. You can see the characters, like A, 7, *, etc., is considered text by Emacs and can be inserted directly. Type (Carriage-Return) to insert a newline character.

You can type to delete the character you finally typed. Is a keyboard key - that you usually use it outside Emacs, use to "delete your last type character". Generally, it is a big key in the upper number, is usually labeled as "Delete", "Del" or "Backspace".

If there is a big key labeled "Backspace" there, then that one is the key you use. There may be another key labeled "Delete" in some place, but that is not.

More generally, it will be deleted in front of the current cursor position.

>> Do now - type some characters, then type several times to delete them. Don't worry that this file will be famed; you will not affect the original quick guide. (You will see now) This is your personal copy.

When a line of text becomes longer than "one line in the pane", this line of text "continues" to the second row of pane. At this time, a backslash "" (or if you use the window, it is a small curved arrow), which is located at its right border to point out the line.

>> Insert text, until you reach the right bound, then continue insert. You will see a continuation line.

>> Use to delete some text until this is another pane. The continuation line disappeared.

You can delete newLine characters like deleting other characters. Delete the newline character in both lines will make them merged into a line. If the result of the merge makes this line too long, it cannot match the width of the pane, which will be displayed in a connection.

>> Move the cursor to the beginning of the Bank and type it. This will combine the Bank as a row with the previous line.

>> Type to reinsert the newline character you just deleted.

Remember that most of the EMACS commands can give a repetition count; this also includes a text character. Repeating a text character will insert it several times.

>> Try Now - Type C-U 8 * to insert ********.

You have now learned most of the basic methods of "Typing a Type of Emacs and Correct Error". You can also delete it "in words or behavior units". Here you have a summary of "Delete Action": Deleting the previous character C-D in the cursor to delete the latter's latter characters

M- Delete the previous word M-D in the cursor to delete the next word of the cursor

C-K deletes characters from the "row" between the cursor to delete the character from the cursor to the "sentence tail"

Note "and C-D" also "M- and M-D" are extended in parallel from C-F and M-F (um, not control characters, but there is nothing to worry). C-K and M-K are like C-E and M-E to some extent, if the "one line" and "one sentence" are ratio.

You can also use one way to remove any part of the buffer, first move to one end of the part you want to delete, then type C- @ or C-SPC (any one). (SPC refers to Space Bar) to the other end of the part, then type C-W. This will delete all words between the two locations.

>> Move the cursor to the "you" word starting with the previous paragraph. >> Type C-SPC. Emacs should display a "Mark Set" message below the screen. >> Move the cursor to the "end" word in the second row. >> Type C-W. This will delete the text from "you" to just "end".

Note that the difference between "killing" and "deleting" is that the killed can be pulled back, and the deleted cannot be. [It is a bit difficult to understand, you can think so: (1) "Murder" is still filled with dead bones, and "deleted" is no bones! It can be seen that "delete" is much more serious than "killing" than "killing". (2) In fact, even if it is deleted, we still have a technology to save it, especially text information, and the premise is that the formatting of physical memory cannot be performed after deletion. But this is impossible for general users, so this situation is not considered. 】 Reinserted the killed text called "Yanking". In general, the command that can remove a lot of text will store those texts (they can be pulled back), and those who just delete a character or just remove the blank line or blank command, will not Store these deleted texts (so you can't pull the text back).

>> Move the cursor to the beginning of a non-blank line. Then type C-K to kill the text on that line. >> Type C-K for the second time. You will see that it kills the newline character behind the line.

Note that separate C-K will kill the content of a row, and the second C-K will kill the line itself and make all other lines move up. CK handles digital parameters in a very special way, it will kill a lot of rows and their content, which is not only repeated, Cu 2 CK will kill both lines and their newline characters; if just type CK twice Not like this.

The action that will be recovered by the killed is called "YANKING". (Imagine it into what you take away from others, you can pull back in your delete text, or pull back elsewhere. You can pull back the same text several times to make it a copy of it.

The command pulled back is C-Y. It will reinsert the last killed text in the position of the current cursor.

>> Try to see; type C-Y pull back.

If you have done a few C-K continuously, all the characters killed will be stored together, so C-Y will pull all these rows back. >> Now, type C-K several times.

Now you have to restore those who killed:

>> Type C-Y. Then move the cursor to a few lines, and then type C-Y again. You now know how to copy some text.

If you have some words you want to pull back, but later you have killed something, so what should you do? C-Y will pull the recently killed, but the previous text has not disappeared, you can use M-Y to return to it. When you have used C-Y to pull back recently, type M-Y to replace these pull back the text to be killed. Type M-Y again and again will bring the text you have previously killed before. When you get to the text you want to find, you don't need to do anything to save it, just keep your editing, stay there of these raised texts.

If you have made M-Y many times, you may return to the starting point, that is, killing recently.

>> Kill a line, around it, and then kill another row. Then use C-Y to bring the row of the second killed. Then use M-Y, it will be replaced by the line of the first killed. Do a few more M-Y to see what you will get. Not interrupted, until the second kills, do it a few times. If you want, you can try to give m-y or negative parameters.

* Cancel action (undo) --------------------

If you make some changes to the text, then I feel that it is an error, you can cancel this change in the undo command, C-X u.

Usually C-X u cancels the change caused by a command; if you repeat many C-X u in a row, each repetition will cancel additional commands.

But there are two exceptions: (1) There is no change to change the text is not counted (this includes the cursor movement command and the reel command); (2) The character typed in a group of one group - up to 20 each group Treatment. (This is to reduce the number of times you must type C-X u in canceling "village entry")

>> Kill this line with C-K, then type C-X u, it will appear again.

C-_ is another cancel command; its role is like C-X U, but it is easier to type many times in a row. The disadvantage of C-_ is that it is not clear how to type it in some keyboards, which is why we provide C-X u. In some terminals, you can press and hold the Control and type / to type C-_.

A digital parameter is a number of repetitions for C-_ OR C-X u.

* File (file) ----------------

In order to make your text permanently save, you must put it in a file. Otherwise, when you quit Emacs, it will disappear. In order to put your text in the file, you must "find" file before you type these text. (This is also called "Visiting" file)

Find a file indicating that you can see the contents of the file in Emacs. From many aspects, it is like you have to edit the file directly. However, until you "save" this file, the change you use to edit the Emacs is not saved. This is why you can avoid the file that you want to change to half when you don't want it. Even if you are stored, Emacs will also keep the original file with a different name. If you think that your change is an error, you can use it. At the bottom of the screen, you can see a row that starts with the broken number - usually start with "-: - tutorial.cn" or other similar things. This is part of the screen, usually used to represent the file you are visiting. Now, the file you are visiting is called "tutorial.cn", it is your personal copy. When you find a file with Emacs, the name of that file will appear in that place.

Among the commands of looking for files, there is a very special thing that you must say this name you want. We said this command "a parameter from the terminal". (In this example, this parameter is the name of the file) When you type this command,

C-X C-F Find a file

Emacs will want you to type file name. The file name you typed will appear on the bottom of the screen. The bottom row is called a small buffer when it is used as an input in this form. You can edit this file name using the normal Emacs editing command.

When you are typing a file name (or when any small buffer input), you can cancel it with the C-g command.

>> Type C-X C-F and type C-G. This will cancel the small buffer and will also cancel the C-X C-F command of this small buffer. So you didn't find any files.

When you type this file name, type it to end it. Then the C-X C-F command will begin to work and find the file you selected. The small buffer disappears when the C-X c-f command ends.

After a while, the content of the file will appear on the screen, then you can edit its content. Type this command when you want your change to save permanently:

C-X C-S Store this file

This will copy text in Emacs to the file. When you first do this action, Emacs will rename the original file into a new name so that it will not disappear. The new name usually adds "~" to the name of the original file.

When the store ends, Emacs will list the names of the write file. You should regularly save, so if the system hangs, you will not lose too much work.

>> Type C-X C-S to store your copy of this Quick Guide. This will display the message of "wrote ... tutorial.cn" below the screen.

Note: In some systems, type C-X C-S will freeze the screen, you will not see any output from Emacs. This means that the operating system is "function" called "flow control" to intercept the C-S command and do not allow it to pass to Emacs. To cancel the freezing of the screen, type C-Q. Then to the EMACS manual to see the topic of "SPONTANEOUS Entry TOINCREMENTAL SECH" to obtain recommendations for processing this "function".

You can find an already existing file and watch it or edit it. You can also find a file that has not been existed yet. This is a way to build a file in Emacs: Find this file, start from zero, then start inserting text into this file. When you ask "Store" file, Emacs will really build a file and put the text you insert into the file. From then start, you can be a file that you already exhibited. * Buffer (Buffer) --------------------

If you "find" in C-X C-F ", the first file still exists in Emacs. To switch back, you can find it once again C-X C-f. In this way, you can open a lot of files in Emacs.

>> Establish a file called "foo" in a way that type C-X C-F foo. Then insert some text, edit it, and then store "foo" in C-X C-S. Finally, type C-X C-f Tutorial.cn to return to this quick guide.

Emacs stores the text of each file in a target called "buffer". Find a file to create a buffer in Emacs. I want to see the list of buffers in your Emacs. Type

C-X C-B lists buffers

>> Try Now C-X C-B

See how each buffer is named, which may also have a name of "Files of the Content". Your "any" text you see in an Emacs pane is part of a buffer.

>> Type C-X 1 to exit the buffer list

When you have several buffers, only one of them is "current role." And that is your buffer in editing. If you want to edit another buffer, you must "switch" to it. If you want to switch to a buffer connected to a file, you can use C-X C-F to visit the file again. But there is a relatively simple way: use C-X b; in this command, you must type the name of the buffer.

>> Type C-X B Foo to return a buffer with text "foo". Then built C-X b tutorial to return to this quick guide.

For most cases, the name of the buffer is the same as the name of the file (removed the directory part in the file name). However, it is not always the case. The list of buffers you produced in C-X C-B will always display the name of each buffer.

Your "any" text you see in an Emacs pane is always part of a buffer. There are some buffers that are not connected to the file. For example, a buffer named "* buffer list *" does not have any files. It is a buffer that contains a list of buffers that you created in the C-X C-B command. Buffers named "* messages *" are not connected to any file; it contains messages that appear in the bottom in your EMACS operation phase.

>> Type C-X B * Messages * to see the message buffer. Then type C-X B Tutorial to return to this Quick guide.

If you make changes to the text in the file, then find another file, this action does not store the first file. Its modification still exists in Emacs, which is in the buffer of that file. The establishment or editing of the second file does not affect the buffer of the first file. This is very useful, but this situation also shows that you need "a convenient method" to store the first file buffer. Just to store the first file, you must switch the buffer with a C-X C-F to save it, it is always a hateful process. So we have

C-X s stores some buffers

C-X S will ask for each buffer that you have made but have not stored. It will ask you, do you want to store for each such buffer?

>> Insert a line of words and type C-X s. It should ask if you want to store buffers called Tutorial.cn. Type "Y" to answer.

* Extending The Command Set ---------------------------------------------------------------------- ---

Because Emacs has too many commands, even if all Control and Meta characters are used, there is no way to put it completely. Emacs solves this problem with X (expanded "Extend") command. There are two types of expansion commands:

C-X character expansion. The back is followed by a character. M-X has a named command expansion. The back is followed by a long name.

There are still some commands to usually use it, but it is less used than you have learned. You have seen two: C-X C-F in the file command, and C-X C-S is stored. Other examples have commands with the Emacs phase - this command is C-X C-C. (Don't worry that you will lose your changes, C-X C-C will provide opportunities to store each change before it kills Emacs.)

C-Z is * temporary * Exit Emacs command - so you can return to the same EMACS phase later.

In some systems that allow it, C-Z will "suspends" Emacs, that is, it will return to the shell but will not destroy Emacs. In the most common shell, you can restore Emacs with "FG" or "% Emacs".

In a system that does not provide a pause function, C-Z will create a Subshell under Emacs to allow you to have another program, and return to Emacs later, it does not really exit Emacs. In this example, the shell command "exit" is a normal way from Subshell back to Emacs.

Time to use C-X C-C is when you plan to log out. It is also very suitable for exiting Emacs that is started by other mail handles and many different applications. However, in the general situation, if you don't plan to log out, it is best to pause Emacs instead of exiting it.

There are many commands for C-X. Here is a list you have learned:

C-X C-F File. C-X C-S Stores the file. C-X C-B lists the buffer. C-X C-C exits Emacs. C-X 1 In addition to one, remove all other panes. C-X u cancels the action.

The command named by the expansion is usually uncommonly used commands, or the commands that only use in a specific mode. An example is a string command that will replace a string in the whole world. When you type M-X, Emacs will ask you on the bottom of the screen, then you should also type the name of this command. In this example, "Replace-String" simplys "REPL S", and then Emacs will make up this name. To end this command name.

The substitute string command requires two parameters - the substituted string and the string used to replace it. You must end each parameter with a newline character.

>> Move the cursor to the lower two rows of the Bank, then type M-X Repl Schangedaltered.

[For the purposes of illustration, the original text is retained. Notice how this line haas change: you've replaced ...]

Please note how this line changes: After the start position of the cursor, you have already put C-H-A-N-G-E-D in the word - no matter where it appears - the word "altered" is replaced.

* Auto Save ------------------------- When you have made modifications in a file, you have not stored them. So if your computer is a machine, they will be lost. In order to avoid this situation, Emacs will periodically write files you are editing into the "Auto Save" file. Automatic storage files have a # symbol before and after the file name; for example, if your file is named "Hello.c", then its automatic storage file file name is "# Hello.c #". When you store files in a usual manner, Emacs will remove its auto storage file.

If you hang, you can find a file normally, (referring to the file you edited instead of auto storage) and type M-X Recover file to restore your auto storage file. When it requires confirmation, type Yes to continue and restore automatic storage.

* Response area (echo area) -----------------------

If Emacs sees you in a multi-character command, it will be displayed below the pane, called the "response area". The response location is in the last line of the pane.

* Mode Line -----------------------

The right side of the bit in the response area is called "status line". The status line shows some information, such as:

-: ** Tutorial.cn (Fundamental) - L670--58% ----------------

The Bank provides some useful information about "Emacs" and "text you are editing".

You already know what the meaning of the file name is what you are looking for. -NN% - Points you currently in the text file; it means: There is a text bit in the pane on the pane. If the top of the file is in the pane, then it will display - TOP - instead - 00% -. If the bottom of the file is in the pane, then it is display --bot -. If the text file you are watching is small, it is enough to see all content in the pane, then the status line will display - AlL-.

L and numbers indicate locations in another way: they give the current number of rows (line).

The asterisk near the previous indicates that you have changed these words. After you have just visited or stored a file, the part of the status is not as an asterisk, only the dash.

The status line is located in the part of the brackets, which is used to tell you what edit mode is being used. The default mode is Fundamental, that is, you are now using. It is an example of "main mode".

Emacs has many different main modes. There are some of them to edit different languages ​​and / or different types of text, like Lisp mode, Text mode, and more. Only one of the main modes at any time can work, and its name can always be found in the status line, where the location in "Fundamental" is now.

Each main mode makes some commands behave nothing. For example, there are some commands in a program to make a note, and because each program language should grow like a note, there is different ideas, so each master mode must be different. To insert a note. Each main mode is a name of an extension command such that you can use to switch to that mode. For example, M-X Fundamental-Mode is a command to switch to the Fundamental mode.

If you want to edit a text file in a human language - like this one now, you should use the Text mode.

>> Type M-X Text Mode.

Don't worry, no Emacs command you have learned will be changed to any very different form. But you can find that M-F and M-B now treat the poor (') as part of the word. Previously, in the Fundamental mode, M-F and M-B were separated by the slice of the poor. Main mode usually, like the above example, make some exquisite changes: most of the commands "do the same thing" in every main mode, but they work in a different way. [For another example, continue the top of the above, in the note of the program language. The same action inserted into the note, because the program language / main mode you are using different. If you use the C language, Emacs insert "/ * is in the middle of the note block * /"; if you use the Fortran language, Emacs insert "C is headed by character c"; if you are using Basic language, Emacs is inserted into the "'poverty to note text". The editor is so that there is no need for a special editor for different languages, destination or appearance. "Seeking Datong, small" is also established here. 】

To browse the text files you now, type C-H m.

>> Use C-U C-V or several times to bring the Bank to the top of the screen. >> Type C-H m to see where the Text mode is different from the Fundamental mode. >> Type C-X 1 to remove text files from the screen.

The reason why the main mode is called "Major" is because they also have a minormode. The secondary mode is not other options in the main mode, but only the secondary changes. Each time pattern can be enabled or stopped by itself, and all other secondary modes are independent, and Yaye is independent of your main mode. So you can use the secondary mode, or one, or any number of times a combination of times.

There is a secondary mode called Auto Fill mode very useful, especially when editing the text of human language. When this mode is enabled, Emacs will automatically separate the line when you insert a text and make a row too wide.

You can enable Auto Fill mode to M-X Auto Fill Mode. When this mode is enabled, you can use M-X Auto Fill Mode to cancel it. When this mode is not available, this command will start it, and when this mode is enabled, this command will turn it off. We said this command to "switch" mode.

>> Type M-X Auto Fill Mode now. Then insert a string "ASDF" repeatedly until you see it into two rows. You must put a blank between them because Auto Fill is only broken in the blank.

The boundary is usually set to 70 characters, but you can use the C-X F command to change it. You should give you the boundary settings you want in a digital parameter.

>> Type C-X f and attach the quotient 20: "C-U 2 0 C-X f". Then type some text to see Emacs with 20 characters, Fill action between rows and rows. Then use C-X F to set the boundary back to 70.

If you make changes in a paragraph, the Auto Fill mode does not re-Fill, and RE-FILL. To RE-FILL, type M-Q (META-Q), and the cursor must be in it.

>> Move the cursor to the previous paragraph, then type M-Q. * Search (Searching) ---------------------

Emacs can search for strings (strings can be a group of consecutive characters or words) [For Chinese, characters and words are basically the same; "words" referred to here, is the character in English is not blank. set. 】, Search forward or later. Searching a string is a cursor mobility command that moves the cursor to the next place appeared in the string.

Emacs search commands and most editors have different places in which it is "incremental". This means that the search happens after you type the text string you want to search.

The command to start searching is: C-S search forward, C-R search. But wait! Don't try it now.

When you type C-S, it will be found that a string "I-Search" appears in the response area as a prompt. It tells you that Emacs is now in a state called "progressive search", waiting for you to type the string you want to search. Will end a search.

>> Now type C-S to start a search. Slow, type a character, type "Cursor" word, time to stop, pay a little, pay attention to what the cursor happens. Now you have been searching for "Cursor". >> Type C-S again to search for the next appearance position of "CURSOR". >> Type four times now, see how the cursor moves. >> Type the end of the search.

Have you seen what happened? In a gradual search, Emacs tries to go to the next appearance location of the string you typed. To move to the next appearance position where the cursor is located, just type C-S again. If there is no such appearance location, Emacs will serve and tell you the current search "failed". In addition, C-G can also be used to end the search.

Note: In some systems, type C-S will freeze the screen, you will not see any output from Emacs. This means that the operating system is "function" called "flow control" to intercept the C-S command and do not allow it to pass to Emacs. To cancel the freezing of the screen, type C-Q. Then to the EMACS manual to see the topic of "SPONTANEOUS Entry TOINCREMENTAL SECH" to obtain recommendations for processing this "function".

If you are in a progressive search, you can find that the last character in the search string is eliminated, and the search will return to the last place of this search. For example, it is assumed that you have typed "C" to find "C" first appearance. Now if you type "u", the cursor will move to the first appearance position of "CU". Typing now, this will eliminate "U" from the search string, and the cursor will move back to the first appearance position of "C".

If you are in the middle of a search and type a Control or Meta character, (but there are some exceptions - special characters for the search, like C-S and C-R), the search will end.

C-S will start a search, which will look for any location of the search string in the current cursor position. If you want to search in the previous text, type C-R as an alternative. In addition to the direction of the search, we are raised to all things about C-S and can be applied to C-R.

* Multiple Windows -------------------------------- Emacs Many good features are, You can show more than one pane simultaneously on the screen.

>> Move the cursor to this line and type C-U 0 C-L.

>> Type C-X 2 now, which will divide the screen into two panes. These two panes show this quick guide. The cursor stays above the pane.

>> Type C-M-V to roll down the pane below. (If you don't have a true META key, type ESC C-V.)

>> Type C-X O ("O" means the meaning of other "Other", move the cursor to the lower pane.

>> In the lower pane, use C-V and M-V to scroll it. Continue to maintain reading these guidelines in the pane above.

>> Type C-X O to move the cursor back to the pane above. The cursor will return to it in the upper pane, the original location.

You can continue to switch between the panes in the pane. Each pane has its own cursor position, but only one pane will really display the cursor. All usual editing commands will only be applied to the pane where the cursor is located. We call this "selected pane".

Command C-M-V is very useful when you edit text when you are in a pane and use other panes as a reference. You can keep the cursor in the pane you are editing, and advance in other panes in other panes in the C-M-V instruction. [Verification work is especially suitable for this way, such as GNU Chinese translation team: find an original English file; find it to translate a good Chinese file, edit this "selected pane", keep up with the verification with the CMV command Passage ... 】

C-M-V is an example of a Control-Meta character. If you have a true META key, you can press and hold the C-m-V at the same time in V. Control or Meta "Who is first held" does not affect, because the two keys are used to modify the characters you typed.

If you don't have a true meta key, you can use ESC to be replaced, so that you must type ESC, follow the Type Control-V, and Control-Esc V will not work. This is because ESC is a character with its own role, not a modified key.

>> ((in the upper pane) Type C-X 1 to remove the lower pane.

(If you have type C-X 1 on the bottom pane, you will hide the above pane. Imagine this command to "only one pane - I am editing this.")

You don't need to display the same buffer in two different panes. If you use C-X C-F to find a file in a pane, the other pane is not changed. You can find a file in the independent pane.

There is another way here to use two panes to display two different things:

>> Type C-X 4 C-F, follow the name of one of your files. Take it as an end. Look at the specified file appears below the pane. The cursor also ran there.

>> Type C-X O to return to the top pane, then remove the lower pane with C-X 1.

* Recursive Editing Levels ----------------------------------------- ---

Sometimes you enter the so-called "recursive editorial class". It is indicated by the square row of bits in the status line and contains the model name indicated by the brackets. For example, you may see [(Fundamental)], not Fundamental. To exit the recursive editorial class, type the ESC ESC ESC. This is a full-featured "exit" command. You can also use it to remove excess pane and exit the bubble.

>> Type M-X to enter the small buffer; then type the ESC ESC ESC exit.

You cannot use C-G to exit the recursive editing class. This is because C-G is used to cancel the command and "arguments" "" "in the" recursive editorial ".

* Getting more help) ---------------------------------------

In this fast guide, we try only to provide just good information, let you start using Emacs. There is too much information in Emacs, and all explanations are not possible here. However, you may want to learn more emacs-related information because it has many other useful features. Emacs provides a command for "reading about Emacs Commands". These "help" commands start as the character of Control-H, called "Help Character".

To use the HELP function, type the C-H character, and then type a word that describes the help you want. If you really don't know what to ask, please type "C-H?", At this time Emacs will tell you the help it can provide. If you have typed C-H, but find that you don't need any help, type C-G to cancel it.

(Some websites change the meaning of CH. They really don't set it the ways to apply all users, so you have a reason to complain about system managers. At the same time, If the CH does not display any messages related to the help at the bottom of the pane, try to type the F1 key, or MX HELP.)

The most basic HELP function is C-H C. Type C-H, character c, and one or a string of characters; then Emacs will display a very short-on-order explanation.

>> Type C-H C C-P.

The news should be like this:

C-P Runs the Command Previous-Line

This tells you "the name of the function". The function name is mainly used from the binding and expand Emacs. However, since the function name is "used to point out this command," can therefore be used as a very short text file - enough to remind you that you have learned.

The multi-character command is like C-X C-S and (if you don't have a meta or edit or alt key) V or it can also appear behind C-H C.

To achieve more information about a command, use C-HK to replace C-H c.

>> Type C-HK C-P.

This will display the description file of this function in an Emacs pane and its name. When you read it, type C-X 1 to jump away from these help characters. You don't need to do it right away. You can do some edits, type C-X 1 when referring to helping text.

There are some other useful C-H options here:

C-H f explains a function. You want to type the name of this function.

>> Try to type C-H f Previous-Line. This prints all the information about "function" function for C-P this command "

The similar commands of C-H v show "You can use a variable from the Emacs behavior". When Emacs requires, you need to type the name of this variable.

C-H A Command Related Find (Command Apropos). Type a keyword and then Emacs list all the commands all "contains this key in its name". These commands can be started via META-X. For some commands, the command-related lookup will list the "can perform the string of one or two characters of the same command". >> Type C-H a file.

This will display a list of "all M-X commands" in its name "in its name. You will see the "Character-Command" column like C-X C-F is next to its correspondence command name (such as: find-file).

>> Type C-M-V to move the Help pane. Try a few times.

>> Type C-X 1 to delete the Help pane.

C-H i Readline User Manual (A.K.A. Info). This command will bring you a special buffer called "* info *", where you can read the online use manual installed in your system. Type M Emacs to read the Emacs manual. If you have not used the INFO system before this, type "?". Emacs will take you into the Guide for the INFO mode function. Once the study of this quick guide is completed, you should check the Emacs INFO manual as a primary reference file.

* More features (more features) --------------------------------

You can learn more about it by reading the Emacs User Manual There are two feature features that you might specially like to save typing, but also a Dired file processing.

Completion is a way to avoid unnecessary typing. For example, if you want to switch * Messages * buffers, you can type C-X B * m, as long as you can determine from the text you already type, Emacs will make the remaining buffer name. Completion is interpreted in the INFO of the Emacs User Manual, called "completion" node.

Dired allows you to list files in a directory (optional), moving, visiting, renaming, deleting, and pairs in the list. Dired is explained in the INFO of the Emacs Manual, called "Dired" node.

The manual of the User's manual also explains the features of many other Emacs.

* Conclusion ----------------------

Remember, use C-X C-C to completely exit Emacs. To temporarily quit to the shell, return to Emacs later, use C-Z.

This quick guide should be easy to understand for all the novices, so if you find anything unclear, don't just sit down - (to this article author and translation), let it go!

* Translation -----------------------

The list of translators of this quick guide is as follows, and if you are reading this article, "complete" does not have a concept for Emacs, please tell us your opinion as a subsequent improvement basis for this article. Translation also provides a "GNU Emacs Chinese Processing Description" at http://www.gnu.org/software/chinese/guide/emacs-chinese.cn.html , Please refer to yourself.

The editor is the most frequently exposed application, so it should not make the beginners feel too difficult. In general comments, Emacs is the editor that is not difficult to learn, but your opinion can make it more Close to the general user, and make the computer as a tool role. If you are willing to provide improved comments, please send email to. Please don't be shy, we welcome any discussion; if you don't want to send a message list, please email directly to this article. This is included in the Title line "Emacs Tutorial: Issue Here>". If you are an Emacs old hand, GNU Chinese Translators Team (GNU / CTT) Welcome to join us, we are now willing to be willing to invest in translation Emacs manual.

This quick guide does not use the translation term used to habits, on the one hand, because of its practical meaning and the general editor, the original text is different; on the other hand, because of the visual design concept used by Emacs, The window is existed before the window, the essence is different. In short, translation is to help understand the entire design philosophy of Emacs. If you receive a reply, most of the requirements make changes, we are still as good.

(0) In order to avoid the confusion of "cursor movement command", the term used in this paper is: move forward; move backware [or "back" movement]; "Previous line"; Next line. (1) In this article, "line" refers to ROW, which is a general habitual usage. In order to avoid misleading Chinese readers, specifically herein. In formal usage: "column" translated into "line", "vertical" is line (straight), also translated into a "column"; "row" is "column", "horizontal" is column (horizontal) . Readers think "combined with horizontal" should be understood. About because Chinese is originally straightforward, we say "one line" is no problem; but now most of the Chinese is the horizontal book, because the habits are also called a word. (2) For "text" and its collection, the translation is used: Edited "text": "Then type some text"; "Text file" used as a description function: "This function is described. File ";" Text "in which the content explained is" "actual effectiveness is based on English." Even if it is just a "one line", as long as it is used as an explanation, the translation is deemed to be "document". (3) The action of "CUT" is divided into "kill" and "delete" in Emacs, and the difference in the general editor: Only recently Cut's text to clipboard; "kill "Killing": The text killed, all is added to Kill Ring; "Deleting": The deleted text is deleted. So in the general editor, you can only "recently" recently "recently text; in Emacs, you can" pull back "any text that is previously killed, and its method is easy. As for the deleted, because the number of characters that can be removed is very small, there is nothing to pull back; if you really want to restore these words, Undo Your action is. (4) "Window" is translated into "Windows" and "pane", the former represents the window system in the general concept, such as "X Window"; the latter represents the window in Emacs, translated here is here "pane ". Emacs' "Pane" can work normally even under the command tips, this basic feature is clearly cured. We describe it in another dedicated term. (5) About documents, "find" one file has two functions in Emacs: find a "reserved" file, readers should recognize "new files"; find a "existing" file It is "Open Old File". Emacs is only solved with a "find" action, the main reason is "actually" software work. The hackers should find that it is more natural because it reflects the working method of the computer, and there is less nonsense while operating. (6) Remarks of the translation in []. (7) The problem has been resolved on the problem of structured Chinese document structure. (The list of simple terms used in this translation text is as follows: zh CN file document software software job Operation Suite package window window handback recursive hacker information

In addition, we also welcome readers to directly modify this quick guide, make their own version, and introduce Emacs in the most appropriate way. If you make such a personal version, and think it is for your reference to use, please send it, we will open your version in the GNU / CTT web page to download. Translation: Liu Zhaohong verification: Ma Xueping

* Copying -------------------

This quick guide follows the version of the Emacs with a long history, starting with the version written by Stuart Cracraft for the original EMACS.

This version of the quick guide and GNU Emacs are all copyright, and it is allowed to discharge its copy under certain conditions:

Copyright (C) 1985, 1996, 1998, 2001, 2002 Free Software FoundationChinese Translation by Chao-hong Liu (2002, 2003)

Permission is granted to anyone to make or distribute verbatim copiesof this document as received, in any medium, provided that thecopyright notice and permission notice are preserved, and that the distributor grants the recipient permissionfor further redistribution as permitted by this notice.

This article allows you to publish the copyright statement and license statement in the premise of not change the content of the document, but the disconnector must also give the recipient to the permitted license allowed by this statement. This paragraph provides readers as a reference to help understand, and actual effectiveness is based on English. 】

Permission is granted to Distribute Modified Versions Of this Document, or of portions of it, under the Above conditions, provided Also That Theycarry Prominent Notices Stating Who Last Altered Them.

This article allows for a modified version, or part of them, but they must also have a significant declaration, which must be significant under the same conditions as described above. [Copyleft Copyright In addition to providing users free, it also maintains the original author, and the reputation of the later modification author. The translation of this paragraph provides the reader as a reference to help understand, and the actual effectiveness is subject to English. 】

Copying Emacs itself is more complicated, but has the same spirit. Please read your Copying this file and you really give your friends GNU Emacs copy. Please help eliminate software barriers (ownership) via "use, write, and share free software"!

转载请注明原文地址:https://www.9cbs.com/read-60330.html

New Post(0)