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>.|

clumsyjedi
  • 121
  • 3

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
  • 27,064
  • 61
  • 75
  • 116
clumsyjedi
  • 121
  • 3
  • Thanks for closing the loop on your question. Can you expand your answer a little to explain what you did to solve it? – fixer1234 Jul 13 '15 at 03:13
  • I really don't have much insight on the issue. I deleted pathogen plugins from ~/vim/bundle and re-tested until it worked. Presumably vim-sensible thinks it is sensible to transform line endings in user inputs (ie pasted data, keyboard inputs) from windows to unix style. – clumsyjedi Jul 13 '15 at 05:41