Remove the ^M in Vim
To remove the ^M characters from a MS-DOS file, enter the command::%/{Ctrl+V}{Ctrl+M}//{Enter}
This command starts with a colon (:) to tell Vim to enter ex mode. All ex start with a line number range, in this case its from the first line (1) to the last ($). The slash indicates the start of the "from text". The {Ctrl+V} tells Vim to treat the next character as a regular character even if it's a special one. The next character is {Ctrl+M}. (This would be treated as {Enter} without the {Ctrl+V}.) The next slash ends the "from text". What follows is the "to text" enclosed by slashes. In this case it's nothing (//).
Not display the ^M
You also can :set fileformats=dosIt will hide the ^M's, without touching the file.
Using dos2unix
There's a program called dos2unix that should strip those for you. Windows uses different line-ending characters which is why that happens.dos2unix
Hiç yorum yok:
Yorum Gönder