I recently learned about Vimtutor. Vim is widely used. many commands will be forgotten once they are not used. below I will make a simple summary of the commands that are not used, for future review. Common commands such as Save and insert are not recorded...
I recently learned about Vimtutor. Vim is widely used. many commands will be forgotten once they are not used. below I will make a simple summary of the commands that are not used, for future review. For common commands such as Save, insert, and so on, we will not record them. in the future, we will just need to deepen the exercises.
1. Type 0 (zero) to move to the start of the line.
Type 2 w to move the cursor two words forward.
Type 3e to move the cursor to the end of the third word forward.
2. Type x to delete the first unwanted character.
Type rx to replace the character at the cursor with x
3. To change until the end of a word, type ce (ce + corrected word)
4. C is similar to d. De, dw, and d $ all correspond to ce, cw, and c $
5. Type CTRL-G to show your location in the file and the file status.
Type G to move to a line in the file.
6. Press G to move you to the bottom of the file.
Type gg to move you to the start of the file.
7. Type/followed by a phrase to search for the phrase.
8. To search for the same phrase again, simply type n.
To search for the same phrase in the opposite ction, type N
9. To search for a phrase in the backward ction, use? Instead/
10. To go back to where you came from press CTRL-O
11. use % for matching, place it under a bracket, and enter % to jump to another one.
12. type: #, # s/old/new/g where #, # are the line numbers of the range
Of lines where the substitution is to be done. (all text between two lines)
Type: % s/old/new/g to change every occurrence in the whole file. (no prompt, but the entire file)
Type: % s/old/new/gc to find every occurrence in the whole file,
With a prompt whether to substitute or not. (prompt whether to replace)
13.g indicates that all of the rows are replaced.
For example, s/thee/the/g indicates that all thee in the row is replaced by.
14. CTRL-G displays your location in the file and the file status.
G moves to the end of the file.
Number G moves to that line number.
Gg moves to the first line.
15 .:! Run the external program. (The colon is required and the command mode is required. for example, w indicates saving.) (external commands such as ls and pwd must be used !, Internal commands are direct: w and so on, no need to use !)
16. enter v to enter the visual mode. at this time, the mouse selects some text and then you can operate on the selected text.
For example, w TEST will save the selected bit text.
: D: the selected text is deleted.
17. insert part of a file. use r FILENAME to insert a file to this row.
18. create an empty row in the lower part, and use o,
Create an empty row in the upper part and use O. (In command mode) (enter the command to enter the insert mode)
NOTE: a, I and A all go to the same Insert mode, the only difference is where
The characters are inserted. (a is after the cursor, A is at the end of the row, and I is at the cursor)
19. e jump to a word. E. g: 2e indicates to jump to two words, which is faster than right-clicking.
G. E. g: 721G indicates the jump to 721st rows
20. replace:
R: replace multiple letters
R: replace a single letter
21. Move the cursor to the end of the next line: j $
22. Use the y operator to copy text and p to paste it
NOTE: you can also use y as an operator; yw yanks one word.
23. Set the 'IC '(Ignore case) option by entering: set ic (including case-sensitive matching, such as Ignore and IGNORE)
Set the 'hlsearch' and 'incsearch' options: set hls is (highlighted)
(Set option)
24. Typing ": set xxx" sets the option "xxx". Some options are:
'IC ''ignorecase' ignore upper/lower case when searching
'Is ''incsearch' show partial matches for a search phrase
'Hls' hlsearch' highlight all matching phrases
You can either use the long or the short option name.
25. Prepend "no" to switch an option off: set noic
26. in command mode, enter e and press the TAB key. many related commands (commands starting with e) will automatically appear ). (First related)
Press Ctrl + D to display all commands starting with him.
From my programming Park