5.5 Entering edit mode
5.6 VIM Command mode
5.7 Vim Practice
Extended
Special usage of vim http://www.apelearn.com/bbs/thread-9334-1-1.html
Vim Common shortcut key summary http://www.apelearn.com/bbs/thread-407-1-1.html
Vim quickly deletes a character http://www.apelearn.com/bbs/thread-842-1-1.html
Vim garbled http://www.apelearn.com/bbs/thread-6753-1-1.html
Small keyboard problem http://www.apelearn.com/bbs/thread-7215-1-1.html
VIM Encryption http://www.apelearn.com/bbs/thread-7750-1-1.html
1. Enter edit mode
How do I enter edit mode?
1. Press the "I" in the lower right corner of the keyboard to display--insert--cursor or in the original position
2. Press the upper-right corner of the "uppercase I" on the keyboard to display--insert---the cursor will be at the beginning of the line
3. Press the "a" in the lower right corner of the keyboard to display--insert---the cursor will be at the position of a character after the location
4. Press the upper-right corner of the "uppercase A" on the keyboard to display--insert---the cursor will be at the end of the line
5. Press "O" on the keyboard to display the bottom right corner--insert---the cursor will be in the row below the line beginning of the position (like enter)
6. Press the "Capital O" button on the keyboard to display the bottom right corner--insert---the cursor will be in the row above the line beginning of the position
2.vim Command mode
: Nohl does not highlight string
: x Save exit resembles: Wq (if the file is open and changed, use: X and: Wq no difference.) If the file has not changed, if you use: Wq will change the mtime time will become the moment you open and use: X will not change anything)
Find string
/String press N to find down press Shift+n to look up
? String press N to look up
Replace
指定替换 :1,100s/单词1/单词2/g, :1,100 从一行开始到100行结束,s 替换, /单词1/单词2/ 把 1换成2 ,g 把文件中所有的1换成2(如果不加g 只是替换每一行的第一个) 全文替换 :1,$s/单词1/单词2/g :1,$s 从第一行到最后结尾 $ 所有的 s结尾,
/Word 1/Word 2/change 1 to 2, G convert all 1 of the file to 2 (if not plus g just replace the first of each line)
How do I replace/aa/bb characters of this type?
: 1, $s/\etc/\hosts\aminglinux.com/g This method is easy to mess up
Push the front/slash with a backslash to make the system think it's a normal character.
: 1, $s #/etc/hosts#aminglinux.com/g or: 1,[email protected]/etc/[email protected]/g This method is easy to identify
3.vim Practice
Upper K Lower J left H right L
Ctrl+f down a page ctrl+b up one page
NG moves to nth row
SHIFT+4 cursor moves to the end of the line shift+6 the cursor moves to the beginning
G move to the last line of the file
GG moves to the first line of the file
U restore the meaning returned by the previous action
X Delete character
Y after visualization press V to select multiple characters and press X to delete
DD Delete entire row
/string and then press N to search this file string and view the number of times
Delete all contents of line 37th---42
37G positioning to 37 rows 42-37=6 row 6DD Delete down 6 rows
Copy the contents of line 37--42 and paste it to line 44th above
37G to 37 row 42-37=6 row 6yy copy down 6 lines (copy line is yy)
44G position to 44 line uppercase p paste to 44 lines above (lowercase p pasted below 44 lines)
Move the contents of the 第37-42 line below line 19th
37G positioning to 37 rows 42-37=6 line 6DD cut down 6 rows (cut one line is DD)
19G position to 19 lines lowercase p paste below 19 lines (uppercase p is paste 19 lines to below)
Attention!!! # Cut and restore is two operations to restore the time to press two times U
Move the cursor to the first line and change the first line to "#! /bin/bash "
GG position the cursor to the first row a position the cursor to the last face of the first row
Press I to enter edit mode---insert---x delete character
“#! /bin/bash "Change content Press ESC to exit edit mode
Insert a new line below the first line and enter "#Hello!"
Press O to enter edit mode--insert--Enter return line
Enter "#Hello!"
Around the third lesson 5.5 entering edit mode 5.6 VIM Command mode 5.7 vim practice