One, vim open window under the file appears ^m
First of all understand that DOS (Windows) created under the file line is ^m\$ (CRLF), and under Linux, only the \$ (LF) to do the break symbol;
(^m\$ actually has no \, except that the editor will make it a special symbol by default, so add a backslash)
This causes the ^m symbol to appear at the end of each line when Vim opens a DOS file
This symbol has a large effect, and if it is a shell script, it can cause the "program cannot execute" state
So how to solve it?
Ii. avoid ^m and solutions on each line
1. Can set the use of the editor to break the
As in sublime text, the option: "Default_line_ending": "System",
That changes with the system, under Windows is Crlf,unix is LF
2. Replacing symbols with commands
Vim command line status input:
:%s/[ctrl-v][enter]//g
The function of the ctrl-v is that the ENTER key is considered a special character, not the end of the vim command.
3. Using the Dos2unix command
such as: Dos2unix-k-n test.txt test.new.txt
-K, which preserves the original mtime time format of the file (does not update the last modified time of the file)
-N, which means preserving the original file and outputting the converted content to a new file
Note:-k-n cannot be written-kn, otherwise the execution is unsuccessful;
And, of course, the corresponding Unix2dos commands, which are used to convert each other.
Specific settings can be viewed through Dos2unix--help
Line break characters for DOS and Linux