set encoding=utf-8
set fileencoding=cp1251
set fileencodings=ut8-8,latin1
set laststatus=2
set statusline=%{(&fileencoding)}
Vim help says that only global value of fileencoding
won't for new empty buffers.
Note that 'fileencodings' is not used for a new file, the global value of 'fileencoding' is used instead. You can set it with:
:setglobal fenc=iso-8859-2
But as far as I can see, it works.
Open Vim, open some file (just in case), and then open a new empty buffer (with :enew
, :new
, or :vnew
). Notice the encoding in status line is cp1251.
Why?
utf8-8
orlatin1
which is what you have in'fileencodings'
then that would be incorrect. Looks like it's working just as described in the docs, no?fileencoding
by usingsetglobal
. It is specified with regularset
...:help local-options
: "With:set
both the local and global value is changed. With:setlocal
only the local value is changed, thus this value is not used when editing a new buffer.":verbose setglobal fenc?
and see that it was really set by your vimrc.