Vim Wangyunpeng.txt Create a wangyunpeng.txt file
Enter "I" into insert mode
Display line number, you need to enter ": Se nu" in command mode
Cp/etc/services/tmp/services Copy the Services file under the ETC directory to the TMP directory name is also called services
Vim/tmp/services Edit/tmp/services File
Enter ": Se nu" in command mode to display line number, enter ": SE Nonu" return to suppress line number
Enter "GG" in command mode to navigate to the first line
Enter "G" in command mode to navigate to the last line
Enter "801G" in command mode to 801 rows, note that the output is not visible in command mode
Enter ": 701" in command mode to return to 701 rows
After you move the cursor to any position on this line, such as moving the cursor to 2 on 128
You can enter "$" (in this case, enter "$" in command mode) to move to the end of the line,
Enter "0" (in this case, enter "0" in command mode) to move to the beginning of the line.
Delete the character at the cursor, press "X", press
Press after
Vim/tmp/services Edit the Services file under the/tmp directory
Enter "/ftp" in command mode, search for FTP string, press the letter key "n" to search where the next string appears
Enter "/set IC" carriage return in command mode, ignoring case-sensitive search
Enter "/set noic" in command mode to cancel ignoring case search
Enter ":%s/ftp/wangyunpeng/g" carriage return in command mode, replace FTP with Wangyunpeng
In command mode, enter ": 100,110/wangyunpeng/shuaige/c" carriage return, replacing 100 rows to 110 rows of Wangyunpeng with Shuaige
Note: If vim edits a file accidentally or incorrectly, or quits, the next time you use VIM to enter this file editor will appear some information you think is not friendly, knock "enter" button, turn to the bottom of the message, such as
If this file is not a problem, and want to remove this message, you need to enter
RM/TMP/.SERVICES.SWP Delete this swap file
Edit the file in the input vim/tmp/services command
Transferred from: http://www.cnblogs.com/qiyebao/p/4333976.html
Linux-vim Common operations