I am on Windows 7 running PowerShell version 2.0.
I used the following PowerShell code (from this answer: https://stackoverflow.com/a/65148/360840) to modify my PowerShell profile:
"`nNew-Alias which get-command" | add-content $profile
As expected, it appended the line in question to my profile BUT afterwards, my Vim sessions started showing ^M characters at the end of each line. Very strange! Any clue on what caused it and how to fix it? I tried set fileformat=dos
in Vim but it did nothing.
Here's my Vim version information:
(Not sure how to make the picture larger - this is not its normal size.)
The problem was that the file became corrupted. In such a case, Vim starts displaying ^M characters to alert you to the problem. The fix was to manually remove these characters (%s/^M//g)
.
Still not clear to me, because these characters are SUPPOSED TO BE in the file as Windows file format uses them. But at least the problem was solved.
EDIT: Please see the exchange of comments w/ dash-tom-bang, which provides clarification.