Vim Delete ^m

Source: Internet
Author: User
1. Enter Command mode. Vim's command mode is to enter ":" in edit mode, and the cursor jumps to the last line of the screen, where the colon is displayed, and the command mode is entered.

The contents of the command mode are displayed on the last line of the screen, press ENTER, and VIM executes the command.

2. Enter the following characters in command mode: input:%s/^m$//g

3. Enter. All ^m characters in the file are automatically deleted.

Delete line trailing spaces command::%s/\s\+$//

What exactly does this command mean? % refers to match the entire file, S is the meaning of the permutation, ^m note to use CTRL + V CTRL + M to enter, M after the $ represents the match of the end of the content, and the last G will mean that each row in the matching content to be replaced. Understand the meaning of the command, it is good to use, for example, to replace the vim in a file into vim, you can use this command::%s/vim/vim/g.

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.