1

In Vim in iTerm, I frequently encounter issues surrounding line breaks. For example, if I have a file containing the dreaded ^M most online tutorials will say that to perform a replacement I use a regular find and replace on a file like:

%s/^M/^J/g

My problem is that I am unable to enter the ^M - when I type ^V^M (control+V control+M) what is inserted is actually ^J. The result of this replacement is "no occurences found". Am I doing something wrong or could VIM or iTerm be misconfigured somehow?

Some extra info:

  1. This also occurs in /usr/bin/vi in the Terminal app when set compatible is on
  2. Here is an example line through hexdump, which shows the line breaks after the closing square brackets as hex char 0d, which I believe is ^M

00000120 3c 2f 6c 6f 63 3e 0d 20 20 3c 2f 75 72 6c 3e 0d |</loc>. </url>.|

1 Answers1

0

Found the culprit, looks like it was the pathogen plugin vim-sensible. I simply deleted pathogen plugins from ~/vim/bundle and re-tested until it worked.

fixer1234
  • 28,064