aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2015-08-29 16:11:56 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2015-09-08 10:53:27 +0200
commit6769438cd1392df684c7840ecb81335dc905c87d (patch)
tree120fdb05d504384c07b86bf0fe21badcc409573c /src/nvim/option.c
parentdc9652e68de163290abee880a74bf1727c715a1e (diff)
downloadrneovim-6769438cd1392df684c7840ecb81335dc905c87d.tar.gz
rneovim-6769438cd1392df684c7840ecb81335dc905c87d.tar.bz2
rneovim-6769438cd1392df684c7840ecb81335dc905c87d.zip
encoding: don't allow changing encoding after startup scripts
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 6e82c45edf..dba3bd8a26 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -575,6 +575,12 @@ void set_init_1(void)
mb_init();
}
+ // Don't change &encoding when resetting to defaults with ":set all&".
+ opt_idx = findoption((char_u *)"encoding");
+ if (opt_idx >= 0) {
+ options[opt_idx].flags |= P_NODEFAULT;
+ }
+
/* Set the default for 'helplang'. */
set_helplang_default(get_mess_lang());
}
@@ -2271,10 +2277,11 @@ did_set_string_option (
else if (varp == &p_ei) {
if (check_ei() == FAIL)
errmsg = e_invarg;
- }
/* 'encoding' and 'fileencoding' */
- else if (varp == &p_enc || gvarp == &p_fenc) {
- if (gvarp == &p_fenc) {
+ } else if (varp == &p_enc || gvarp == &p_fenc) {
+ if (varp == &p_enc && did_source_startup_scripts) {
+ errmsg = e_afterinit;
+ } else if (gvarp == &p_fenc) {
if (!MODIFIABLE(curbuf) && opt_flags != OPT_GLOBAL)
errmsg = e_modifiable;
else if (vim_strchr(*varp, ',') != NULL)