diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 18 | ||||
-rw-r--r-- | src/nvim/options.lua | 10 |
2 files changed, 17 insertions, 11 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 81f57522b3..e75cb38c9e 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -236,6 +236,7 @@ typedef struct vimoption { #define P_NO_ML 0x2000000U ///< not allowed in modeline #define P_CURSWANT 0x4000000U ///< update curswant required; not needed ///< when there is a redraw flag +#define P_NO_DEF_EXP 0x8000000U ///< Do not expand default value. #define HIGHLIGHT_INIT \ "8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText," \ @@ -726,6 +727,9 @@ void set_init_1(void) * default. */ for (opt_idx = 0; options[opt_idx].fullname; opt_idx++) { + if (options[opt_idx].flags & P_NO_DEF_EXP) { + continue; + } char *p; if ((options[opt_idx].flags & P_GETTEXT) && options[opt_idx].var != NULL) { @@ -2020,13 +2024,15 @@ static char_u *option_expand(int opt_idx, char_u *val) if (!(options[opt_idx].flags & P_EXPAND) || options[opt_idx].var == NULL) return NULL; - /* If val is longer than MAXPATHL no meaningful expansion can be done, - * expand_env() would truncate the string. */ - if (val != NULL && STRLEN(val) > MAXPATHL) - return NULL; - - if (val == NULL) + if (val == NULL) { val = *(char_u **)options[opt_idx].var; + } + + // If val is longer than MAXPATHL no meaningful expansion can be done, + // expand_env() would truncate the string. + if (val == NULL || STRLEN(val) > MAXPATHL) { + return NULL; + } /* * Expanding this with NameBuff, expand_env() must not be passed IObuff. diff --git a/src/nvim/options.lua b/src/nvim/options.lua index d19af4f73f..060ec8c1e1 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -165,7 +165,7 @@ return { deny_duplicates=true, secure=true, vi_def=true, - expand=true, + expand='nodefault', varname='p_bdir', defaults={if_true={vi=''}} }, @@ -616,7 +616,7 @@ return { deny_duplicates=true, secure=true, vi_def=true, - expand=true, + expand='nodefault', varname='p_dir', defaults={if_true={vi=''}} }, @@ -1891,7 +1891,7 @@ return { deny_duplicates=true, secure=true, vi_def=true, - expand=true, + expand='nodefault', varname='p_rtp', defaults={if_true={vi=''}} }, @@ -2507,7 +2507,7 @@ return { deny_duplicates=true, secure=true, vi_def=true, - expand=true, + expand='nodefault', varname='p_udir', defaults={if_true={vi=''}} }, @@ -2568,7 +2568,7 @@ return { type='string', scope={'global'}, secure=true, vi_def=true, - expand=true, + expand='nodefault', varname='p_vdir', defaults={if_true={vi=''}} }, |