In this article, we will look at 7 techniques for navigating through text in the Emacs program.
1. Proc string
2. Screen
3. Moving by words
4. Special
5. By paragraphs
6. Search
7. Moving from the command line
Designations used in the article:
- Ca: Ctrl-a
- Ma: Meta-a (If you do not have a Meta key (Alt), use the Esc key)
- CMa: Ctrl-Meta-a
|
1. Line navigationThe following four commands will help you navigate within the lines.
- Cp: go to previous line
- Cn: go to next line
- Cf: move one character forward
- Cb: move one character back
Repeated executionTo heighten convenience, you can specify how many times to execute a command using a combination of Cu, for example, to move 10 lines down, type Cu 10 Cp
To move within the line, there are two more useful commands:
- Ca: go to the beginning of the current line
- Ce: go to the end of the current line
2. Go to the "screen"The following three combinations will help you move directly to the "screen" of the text.
- Cv: go forward to the screen (similar to Page Down)
- Mv: go back to the screen (similar to Page Up)
- Cl: set the current line to the center of the screen (center)
In Cv and Mv, you can use the Page Down and Page Up keys, respectively.
3. To the beginning / end of the fileThe following two commands will help you go to the beginning or end of an open file.
- M- <: go to the beginning
- M->: go to the end
4. Going by the wordsKeyboard shortcuts to navigate by the words:
- Mf: move to the next word
- Mb: go to the previous word
5. Transition by paragraphs- Ma: go to the beginning of the current paragraph. Pressing Ma again will take you to the beginning of the previous paragraph.
- Me: go to the end of the current paragraph. Pressing Me again will transfer you to the end of the next paragraph.
6. Search by textTo search by text, use the following keyboard shortcuts:
- Cs: Click Cs, and then enter the search word. Press Cs again to go to the next found word. Press enter to finish.
- Cr: reverse lookup, otherwise the same as Cs.
If you want to perform a search using a regular expression, use the following combinations:
- CMs: Click Cs after entering a regular expression to start the search. Press Cs again to go to the next found word. Press enter to finish.
- CMr: reverse lookup, otherwise the same as CMs.
7. Navigation from the command lineEnter
$ emacs +N filename in the command line to go to the N-th line when opening a file, for example:
$ emacs +10 / etc / passwd
')
And now let's remember all the navigation commands and write briefly in one place:
Cp : Cn : Cf : Cb : Cu N *** : N *** Ca : Ce : Cv : ( Page Down) Mv : ( Page Up) Cl : () M-< : M-> : Mf : Mb : Ma : . Me : . Cs : Cs, . Cr : , Cs. CMs : Cs , . CMr : , CMs. $ emacs +N file : N- |
This text is a free translation of an
article from thegeekstuff.com