Reputation: 4395
I noticed that sometimes Vim shows ^M
at the end of every line, or ^[
in front of an opening bracket [
.
What do these characters mean and how can I get rid of them?
I'm running Vim 7.3 on Debian.
Upvotes: 2
Views: 536
Reputation: 59327
These are control characters. The ^M represents the carriage return, used in windows as the other answer already explain.
The ^[ is the escape character. When followed by a opening square bracket ("[") it probably means an ANSI escape sequence. See this article to know more:
http://en.wikipedia.org/wiki/ANSI_escape_code
And give it a try. For example, in your terminal:
echo ^[[7mHello World!^[[m
Where each ^[ can be inserted with controlVcontrol[. So the sequence of typing is actually:
... controlVcontrol[[7m ...
Upvotes: 1
Reputation: 5187
This article on Vim wiki should help you: File format.
Though the article title may seem to be different it does talk about line endings and unix/dos/macos file formats.
Upvotes: 1
Reputation: 29720
These are control characters. Here is a link on how to remove them in vi.
Upvotes: 1
Reputation: 19345
^M is dos-style line endings. You can get rid of them by using the dos2unix program:
dos2unix (yourfile)
Upvotes: 3