diff options
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 56 |
1 files changed, 18 insertions, 38 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 28bbfb41e7..6428ef1eb3 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -143,6 +143,7 @@ # define PV_KMAP OPT_BUF(BV_KMAP) #define PV_KP OPT_BOTH(OPT_BUF(BV_KP)) # define PV_LISP OPT_BUF(BV_LISP) +# define PV_LW OPT_BOTH(OPT_BUF(BV_LW)) #define PV_MA OPT_BUF(BV_MA) #define PV_ML OPT_BUF(BV_ML) #define PV_MOD OPT_BUF(BV_MOD) @@ -965,10 +966,10 @@ static struct vimoption {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"initclipboard","icpb",P_STRING|P_VI_DEF|P_SECURE, (char_u *)&p_icpb, PV_NONE, - {(char_u *)NULL, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"initpython","ipy",P_STRING|P_VI_DEF|P_SECURE, (char_u *)&p_ipy, PV_NONE, - {(char_u *)NULL, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"insertmode", "im", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_im, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, @@ -1057,7 +1058,7 @@ static struct vimoption (char_u *)&p_lisp, PV_LISP, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"lispwords", "lw", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, - (char_u *)&p_lispwords, PV_NONE, + (char_u *)&p_lispwords, PV_LW, {(char_u *)LISPWORD_VALUE, (char_u *)0L} SCRIPTID_INIT}, {"list", NULL, P_BOOL|P_VI_DEF|P_RWIN, @@ -1596,7 +1597,7 @@ static struct vimoption {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, {"ttyfast", "tf", P_BOOL|P_NO_MKRC|P_VI_DEF, (char_u *)&p_tf, PV_NONE, - {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, + {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, {"ttymouse", "ttym", P_STRING|P_NODEFAULT|P_NO_MKRC|P_VI_DEF, #if defined(FEAT_MOUSE) && defined(UNIX) (char_u *)&p_ttym, PV_NONE, @@ -1933,26 +1934,15 @@ void set_init_1(void) */ opt_idx = findoption((char_u *)"maxmemtot"); if (opt_idx >= 0) { -#ifndef HAVE_TOTAL_MEM - if (options[opt_idx].def_val[VI_DEFAULT] == (char_u *)0L) -#endif { -#ifdef HAVE_TOTAL_MEM /* Use half of amount of memory available to Vim. */ /* If too much to fit in long_u, get long_u max */ uint64_t available_kib = os_get_total_mem_kib(); n = available_kib / 2 > ULONG_MAX ? ULONG_MAX : (long_u)(available_kib /2); -#else - n = (0x7fffffff >> 11); -#endif options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n; opt_idx = findoption((char_u *)"maxmem"); if (opt_idx >= 0) { -#ifndef HAVE_TOTAL_MEM - if ((long)options[opt_idx].def_val[VI_DEFAULT] > (long)n - || (long)options[opt_idx].def_val[VI_DEFAULT] == 0L) -#endif options[opt_idx].def_val[VI_DEFAULT] = (char_u *)n; } } @@ -1995,7 +1985,7 @@ void set_init_1(void) } } -#if defined(MSWIN) || defined(EBCDIC) || defined(MAC) +#if defined(MSWIN) || defined(MAC) /* Set print encoding on platforms that don't default to latin1 */ set_string_default("penc", (char_u *)"hp-roman8" @@ -2369,7 +2359,6 @@ void set_init_3(void) * This is done after other initializations, where 'shell' might have been * set, but only if they have not been set before. */ - char_u *p; int idx_srr; int do_srr; int idx_sp; @@ -2386,28 +2375,10 @@ void set_init_3(void) else do_sp = !(options[idx_sp].flags & P_WAS_SET); - /* - * Isolate the name of the shell: - * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f". - * - Remove any argument. E.g., "csh -f" -> "csh". - * But don't allow a space in the path, so that this works: - * "/usr/bin/csh --rcfile ~/.cshrc" - * But don't do that for Windows, it's common to have a space in the path. - */ - p = skiptowhite(p_sh); - if (*p == NUL) { - /* No white space, use the tail. */ - p = vim_strsave(path_tail(p_sh)); - } else { - char_u *p1, *p2; + size_t len = 0; + char_u *p = (char_u *)invocation_path_tail(p_sh, &len); + p = vim_strnsave(p, len); - /* Find the last path separator before the space. */ - p1 = p_sh; - for (p2 = p_sh; p2 < p; mb_ptr_adv(p2)) - if (vim_ispathsep(*p2)) - p1 = p2 + 1; - p = vim_strnsave(p1, (int)(p - p1)); - } { /* * Default for p_sp is "| tee", for p_srr is ">". @@ -2431,6 +2402,7 @@ void set_init_3(void) || fnamecmp(p, "zsh") == 0 || fnamecmp(p, "zsh-beta") == 0 || fnamecmp(p, "bash") == 0 + || fnamecmp(p, "fish") == 0 ) { if (do_sp) { p_sp = (char_u *)"2>&1| tee"; @@ -3569,6 +3541,7 @@ void check_buf_options(buf_T *buf) check_string_option(&buf->b_p_tags); check_string_option(&buf->b_p_dict); check_string_option(&buf->b_p_tsr); + check_string_option(&buf->b_p_lw); } /* @@ -6594,6 +6567,9 @@ void unset_global_local_option(char *name, void *from) case PV_UL: buf->b_p_ul = NO_LOCAL_UNDOLEVEL; break; + case PV_LW: + clear_string_option(&buf->b_p_lw); + break; } } @@ -6623,6 +6599,7 @@ static char_u *get_varp_scope(struct vimoption *p, int opt_flags) case PV_TSR: return (char_u *)&(curbuf->b_p_tsr); case PV_STL: return (char_u *)&(curwin->w_p_stl); case PV_UL: return (char_u *)&(curbuf->b_p_ul); + case PV_LW: return (char_u *)&(curbuf->b_p_lw); } return NULL; /* "cannot happen" */ } @@ -6670,6 +6647,8 @@ static char_u *get_varp(struct vimoption *p) ? (char_u *)&(curwin->w_p_stl) : p->var; case PV_UL: return curbuf->b_p_ul != NO_LOCAL_UNDOLEVEL ? (char_u *)&(curbuf->b_p_ul) : p->var; + case PV_LW: return *curbuf->b_p_lw != NUL + ? (char_u *)&(curbuf->b_p_lw) : p->var; case PV_ARAB: return (char_u *)&(curwin->w_p_arab); case PV_LIST: return (char_u *)&(curwin->w_p_list); @@ -7022,6 +7001,7 @@ void buf_copy_options(buf_T *buf, int flags) buf->b_p_tsr = empty_option; buf->b_p_qe = vim_strsave(p_qe); buf->b_p_udf = p_udf; + buf->b_p_lw = empty_option; /* * Don't copy the options set by ex_help(), use the saved values, |