On the last turn, the simple introduction of Emacs Some basic common sense, this time continue to say basic knowledge, how to move your cursor. Some people may say that the next key is not very useful, but also with you. Bawl, the power of Emacs is that you can use just the stack of keys on the left side of the keyboard to do anything (excluding the top ESC and function), which is what Emacs is designed for.
In order to test these keys, we enter Emacs when you choose the middle of the page Emacs Tutorial, which can be casually random press don't worry about what went wrong.
First, the basic navigation
Look at this picture below:
The
can remember that, P-previous,n-next,b-backward,f-forward. Here the character for E, is a letter, and Chinese is a Chinese character, in fact, Emacs support for Chinese is very kind, the back slowly can be seen. But here I personally feel that this cursor movement is not vim convenient, others on the HJKL, a key to move, which requires two, Ctrl sometimes feel pressed very awkward, not too harmonious ah.
When you press C-N, if you cross the end of the page, rather than scrolling down a line like the general Windows Editor, the current cursor is placed in the middle of the page. C-p is the same.
The other two use more is c-v PAGE down,m-v page up. Well, there's also a c-l is to refer to the current line in the middle of the page, feel Emacs on the page seems to love a unique ah.
Second, intermediate navigation
The upper section that moves by character says, and then says move by word:
m-f move forward a word, Emacs understands the Chinese word is two punctuation between the things, so Chinese is moved to the next punctuation position. Back is m-b move one word backwards.
c-a moves to the beginning of,c-e to the end of the line.
m-a moved to the beginning of the sentence,m-e moved to the end of the sentence, in Chinese is generally run to the full stop position, here I have to say, now many young people write articles have a tease in the end of the habit, only in the end of the article, if you use Emacs to see your article, A m-e doesn't have to do anything. As a person with a certain literary literacy, I strongly oppose this style of writing articles, disharmony.
m-} moves to the next paragraph, m-{ to the previous paragraph.
There are two faster navigation,m-< move to the beginning of the document, note here is less than the symbol <, not a comma, so we are pressing ALT + Shift +, remember. Moving to the end of the document is m->.
C-x [ and c-x] , respectively, to the previous page and the page down. This page is controlled by page breaks, there are no page breaks in Emacs Tutorial, and all of these keys run to the end of the document header and document.
Example diagram:
The shadow is the position of the current cursor, and the other arrows refer to the position of the cursor after pressing the corresponding key.
Three. Advanced Navigation
You can see the basic navigation is common use, intermediate navigation is a master adopted, advanced navigation is brick home, called the Beast.
M-r move to the middle of the page in the beginning of the position, Holly shit, is the middle of the page, True xx haunted.
M-x Goto-char (n), this is more complex, first press m-x, then the space Goto-char enter, in addition Emacs has the TAB key to complete the function, we can try, if there are multiple options will be prompted, and finally enter an integer. This thing will move to the position of the nth character from the beginning, I reckon no one will be perverted enough to remember that each word is the first character.
M-g m-g [n], press two times m-g, do not enter, prompt for a number, move to the specified line N, two m-g, you can also lose m-g G.
There is also a relatively rare, c-x c-n, which is set to the current column as the target. What does that mean, when we press C-n and C-P, the cursor moves down or up one line, and the column position is the position of the current cursor column, unless the next row is not so many (that is, the character is not so much), and the cursor is to the nearest column from the current column. And we can use this key combination to reset a target column so that when you press C-n and C-P, the cursor runs to the target column we set. If you are unfortunate and are not accustomed to it, you can use C-u c-x c-n to cancel the target column settings. To add, these two commands are disabled commands, is Emacs consider that most people will not use, and the more strange command, so usually disabled, you will not be careful to call out when asked if you need to continue. It looks like this:
Let's just try it a little space.
Finally, there are two repeating commands:
M-n, N is a number, meaning to repeat the next command n times, such as M-3 C-f, is to move forward three characters.
C-u N,n is also a number and repeats the next command n times. If n is omitted, it is 4 times. Press two times c-u, that is, repeat 16 times.
Summary:
Keys |
Command |
Role |
C-f |
Forward-char |
One character ahead |
C-b |
Backward-char |
One character backwards |
C-p |
Previous-line |
Move up one line |
C-n |
Next-line |
Move down one line |
M-f |
Forward-word |
A word forward |
M-b |
Backward-word |
One word backwards |
C-a |
Beginning-of-line |
Move to the beginning of the line |
C-e |
End-of-line |
Move to end of line |
M-e |
Forward-sentence |
Move to the beginning of a sentence |
M-a |
Backward-sentence |
Move to the end of a sentence |
M-} |
Forward-paragraph |
Move down a paragraph |
m-{ |
Backward-paragraph |
Move up a paragraph |
C-v |
Scroll-up |
Move Down one screen |
M-v |
Scroll-down |
Move up one screen |
C-x] |
Forward-page |
Move down one page |
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 G N |
Goto-line |
Move to Nth row |
(None) |
Goto-char |
Move to Nth character |
C-l |
Recenter |
Put the current position in the middle of the page (Emacs's favorite place) |
M-N |
Digit-argument |
Repeat the next command n times |
C-u N |
Universal-argument |
Repeat the next command n times, n defaults to 4 |
Note: Here command this column is to press the M-x to lose the east.
Emacs Tutorial (ii)