What might cause Vim to throw errors on one machine but not the other, considering both systems have identical vim configuration?
I have two Mac OS X Lion machines both running the default vim binary that ships with the OS.
I keep my .vimrc and .vim directory in a git repo. However, starting vim on one of these machines throws an error:
Error detected while processing function <SNR>41_CreateMaps..<SNR>41_DefineVariables..AutoClose#DefaultPairs..AutoClose#ParsePairs:
line 18:
AutoClose: Bad pair string - a pair longer then two character
line 19:
E121: Undefined variable: a:sring
E15: Invalid expression: " `- String: " . a:sring
line 20:
`- Pair: «» Pair len: 4
I keep my plugins organized using the Vundle plugin. The error appears to be caused by the AutoClose plugin.
For the sake of austerity, I removed the vim directory and all .vim files in my home directory then sourced everything from the repo and reinstalled the plugins, but the error remains.
I should add that the issue does not come up when launching MacVim, only vim in terminal.
Since vim comes preinstalled with Mac OS X Lion and my other machine (running the same version of Mac OS) does not generate those errors whilst using the same settings, I’m left clueless as to where to look..
In case it makes any difference, both machines have MacVim installed but the error only shows on one of them and only when launching vim from command line.
This is probably because the file is in a different encoding (latin1 vs UTF-8) than VIM expects.
If you put
scriptencoding utf-8at the top of your .vimrc (assuming your vimrc is actually encoded in UTF-8, use ISO-8859-1 if it’s encoded in Latin1), everything from that point on should be properly recognised.To see more documentation about this feature, type
:help scriptencodingin vim.(source: http://vim.wikia.com/wiki/Converting_LANG_to_UTF-8 and vim manual)