Linux-vim Common operations

Source: Internet
Author: User

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

Linux-vim Common operations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.