Emacs series tutorials (1): basic usage
I opened my head and briefly introduced some basic knowledge about Emacs. This time I will continue to talk about basic knowledge and how to move your cursor. Some people may say that it is not easy to use the up and down keys. Strong, Emacs is powerful in that you can use only the heap keys on the left of the keyboard to do anything (excluding the top ESC and function), which is also the design purpose of Emacs.
To test these buttons, you can select Emacs tutorial in the middle of the page when entering Emacs. you can press the button without worrying about anything.
I. basic navigation
Take a look at the following picture:
It can be noted that P-previous, N-Next, B-backward, F-forward. The character mentioned here is a letter for E, while Chinese is a Chinese character. In fact, emacs supports Chinese characters very well. It will be shown later. However, here I personally feel that it is not convenient for the cursor to move in Vim. If someone else is using hjkl, one key will be able to move. The two are needed. CTRL sometimes feels awkward and not harmonious.
When you press C-N, if the end of the page is crossed, the current cursor is placed in the center of the page instead of rolling down a row in a Windows Editor in the middle of the night. C-P is the same.
The other two are mostly used:C-VFlip down,M-VGo up the page. Er, there is anotherC-lIt is to mention the current row in the middle of the page, it seems that Emacs has a special liking for the page.
2. Intermediate navigation
The previous section about moving by character, and then moving by word:
M-F Move a word forward. The Chinese word understood by Emacs is something between two punctuation marks, so the Chinese word is moved to the next punctuation mark. Back M-B , Move a word backward.
C- Move to the beginning of a row, C-e Move to the end of the row.
M- Move to the beginning of the sentence, M-e Moving to the end of a sentence is generally the end of the sentence. Here I have to say that many young people write Article Just add a full stop at the end of the article. If you use Emacs to read your article, you don't need to do anything about m-e. As a person with certain literary qualities, I am highly opposed to this style of writing articles, which is not harmonious.
M -} Move to the next section , M -{ Move to the previous section.
There are also two faster navigation tasks, M-< Move to the beginning of the document. Note that it is less than the symbol <, not a comma, So we press Alt + Shift +. Remember. Moving to the end of the document is M-> .
C-X [AndC-x] , Respectively to the previous page and to the next page. The page here is controlled by a paging character, and there is no paging character in Emacs tutorial. All these two keys will go to the document header and end of the document.
Example:
The Shadow position is the current cursor position, and other arrows refer to the cursor position after pressing the corresponding key.
3. Advanced Navigation
In this case, the basic navigation is used by ordinary people. The intermediate navigation is used by experts, and the advanced navigation is called The bricklayer and animal-use.
M-R Move to the beginning of the line in the middle of the page, Holly Shit, is in the middle of the page, the real XX ghost is not scattered.
M-x goto-CHAR (N) This is complicated. Press M-X and enter goto-char in a space. In addition, emacs has the tab key complementing function. You can try it. If there are multiple options, a prompt is displayed, enter an integer. This will move to the nth character from the beginning. I don't expect anyone to be abnormal enough to remember the nth character.
M-g [N] , Press Twice m-g, do not press enter, prompt to enter a number, move to the specified row N, two M-G, you can also enter M-g .
There is also a rare, C-x C-n This is to set the current column as the target column. What does this mean? When we press C-N and C-P, the cursor moves down or up a row, and the column position is the position of the current cursor column, the cursor is directed to the column closest to the current column unless there are not so many characters in the next row. However, we can use this combination key to reset a target column, so that when we press C-N and C-P, the cursor will run to the target column we set. If you press it unfortunately and are not used to it, you can use C-u C-x C-n To cancel the target column settings. In addition, these two commands are both disabled commands. Most of them are considered not to be used by Emacs, and they are quite strange commands, so they are usually disabled, when you accidentally call out, you will be prompted to ask if you need to continue. Like this:
Just try it with a space.
There are also two repeated commands:
M-n,N is a number,It means to repeat the next command n times, such as M-3 C-F, is to move forward three characters.
C-u n,N is still a number, and the next command is repeated n times.If n is omitted, it is four times. If you press "c-u" twice, it means to repeat 16 times.
Summary:
|
Buttons |
Command |
Function |
|
C-F |
Forward-Char |
One character forward |
|
C-B |
Backward-Char |
One character backward |
|
C-P |
Previous-line |
Move up a row |
|
C-n |
Next-line |
Move one row down |
|
M-F |
Forward-word |
One word forward |
|
M-B |
Backward-word |
Backward word |
|
C- |
Beginning-of-line |
Move to the beginning of a row |
|
C-e |
End-of-line |
Move to end of line |
|
M-e |
Forward-sentence |
Move to the beginning of a sentence |
|
M- |
Backward-sentence |
Move to end of sentence |
|
M -} |
Forward-paragraph |
Move down a paragraph |
|
M -{ |
Backward-paragraph |
Move up a segment |
|
C-V |
Scroll-up |
Move down one screen |
|
M-V |
Scroll-down |
Move one screen up |
|
C-x] |
Forward-page |
Move one page down |
|
C-X [ |
Backward-page |
Move up one page |
|
M-< |
Beginning-of-Buffer |
Move to Document Header |
|
M-> |
End-of-Buffer |
Move to end of document |
|
M-g N |
Goto-line |
Move to row n |
|
(None) |
Goto-Char |
Move to nth character |
|
C-l |
Recenter |
Place the current location in the middle of the page (favorite place of Emacs) |
|
M-N |
Digit-argument |
Repeat the next command n times |
|
C-u N |
Universal-argument |
Repeat the next command n times. The default value of N is 4. |
Note: The command column is input after M-X.