简体   繁体   中英

Vim imaps stopped working on Mac?

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.

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 \\r s you actually want to keep,

:%s/\r$

With the implied //

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM