0

I was using an older version of vim on Windows, then I switched to a Mac computer and MacVim and brought over my imap files and vimrc, but the imaps no longer work. When I open a file it gives me an "Error detected while processing .. etc. ftplugins/html_imaps.vim" for example:

line 1:

E15: Invalid expression: ";"^M 

The line in question in the imap file says:

let maplocalleader=";"

Is there a reason this doesn't work anymore? It was also giving me an error on each empty line. I deleted the empty lines so those errors went away, but I haven't been able to do anything about maplocalleader line.

Thanks for any suggestions.

Daniel
  • 19,179
  • 7
  • 60
  • 74
aris
  • 22,725
  • 1
  • 29
  • 33

1 Answers1

2

Because your .vimrc file came from a Windows machine, it has \r\n line endings, so you need to get rid of the \r (which shows up as ^M). It looks like my Mac doesn't have dos2unix, so you'll probably want to just use tr:

tr -d '\r' <~/.vimrc >tmp
mv tmp ~/.vimrc 

Or from within vim itself:

:%s/\r//g

On the off-chance you have \rs you actually want to keep,

:%s/\r$

With the implied //

Kevin
  • 53,822
  • 15
  • 101
  • 132