Since Vim and NeoVIM defaults to UTF-8, does it make any sense to specify the same option explicitly in vimrc? set encoding="utf-8"
It would be
set encoding=utf-8, no quotes.
set encoding="utf-8" would be an error because
"utf-8" would be considered a comment, thus it would be the same as
Vim does not actually default
'encoding' to UTF-8. It defaults to latin1, but will change based on the locale of your environment.
However, since changing
'encoding' at runtime is dangerous (as in, it can cause a crash -- see below), Neovim decided to only support
encoding=utf-8. This vastly simplifies the code, since now everything is working with UTF-8 internally, and only has to encode/decode when interfacing with the outside world (saving files in specific encodings, converting input from the locale's encoding, etc.).
IMHO, it's a good idea to always put
set encoding=utf-8 in your vimrc. It automatically enables saner encoding detection settings for
'fileencodings' and supports any characters that you'll need to store.
The crash example I gave in 2009 when I suggested changing Vim's default value for
vim -u NONE --cmd 'set enc=utf8 list' -c 'let &lcs="nbsp:".nr2char("8215")' :put =nr2char("160") :set enc=latin1