For weeks I’ve been going mad trying to figure out why most of the settings in my .gvimrc file were being ignored on MacVim.
At first I thought it must be some strange quirk of MacVim that it didn’t support the same settings a GVim (on Windows) but everything I read online suggested that wasn’t it.
I have my .gvimrc and .vim folders sync’d using Dropbox. I’ve setup symbolic links on my Mac, like this
ln -s ~/Dropbox/vim/.gvimrc ~/.gvimrc
ln -s ~/Dropbox/vim/.vim ~/.vim
And on my windows machine, like this
mklink /H .gvimrc Dropboxvim.gvimrc
mklink /D vimfiles Dropboxvim.vim
This keeps my windows and mac vim things in sync. But it wasn’t working on the mac.
By chance, I decided to step up the mvim script that comes with MacVim, and I notices that when running mvim from the terminal I was seeing lots of errors like this being output to the terminal
E474: Invalid argument: modelines=0^M
E474: Invalid argument: tabstop=4^M
E474: Invalid argument: shiftwidth=4^M
E474: Invalid argument: softtabstop=4^M
This was a clue, at first I thought that windows style rn line ending might be causing it. But it turns out is was that the file was saved using DOS encoding. Clearly it had first been created on the Windows machine. To fix it I opened my .gvimrc file, went to the Edit menu, File Settings, and selected File Format… I clicked on the Unix encoding and now both my MacVim and Windows GVim installs are working fine.