I've upgraded vim and now it's unhappy about some UTF-8 values in my
This lead me to the question -- when vim reads
.vimrc, what encoding does it assume the file has? I.e. what's
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
It is whatever you define whit
:scriptencoding. it should be the first line in you
.vimrc file, e.g.:
scriptencoding utf-8 set number set ...
Be aware that some options (
listchars for example) only accept single width values.
Edit: Yeah, Vim is weird.
encoding is for the editor itself,
fileencoding is for the buffer and
scriptencoding is for Vim scripts.
As hinted at in the help files (
:help scriptencoding), if you do not use
scriptencoding, vim does no conversion, effectively assuming the script is in the encoding of the
'encoding' option. This is very often
latin1. Other encodings are possible. Generally you want to use
when your script file contains non-ascii characters and is encoding in utf-8. If you use only 7-bit ascii characters, it is unnecessary.
'fileencoding' applies to the current buffer, not scripts. When opening a file, vim tries to guess the encoding from the option