diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.c | 14 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 6 | ||||
-rw-r--r-- | src/nvim/memline.c | 3 | ||||
-rw-r--r-- | src/nvim/normal.c | 21 | ||||
-rw-r--r-- | src/nvim/option.c | 8 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 12 | ||||
-rw-r--r-- | src/nvim/regexp.c | 7 | ||||
-rw-r--r-- | src/nvim/regexp_nfa.c | 2 | ||||
-rw-r--r-- | src/nvim/search.c | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test79.in | bin | 3381 -> 3335 bytes | |||
-rw-r--r-- | src/nvim/testdir/test79.ok | bin | 574 -> 570 bytes | |||
-rw-r--r-- | src/nvim/testdir/test80.in | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test80.ok | 2 |
13 files changed, 10 insertions, 77 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index b4adef9235..2c92113404 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -3472,18 +3472,8 @@ void do_sub(exarg_T *eap) } if (!eap->skip) { - /* In POSIX vi ":s/pat/%/" uses the previous subst. string. */ - if (STRCMP(sub, "%") == 0 - && vim_strchr(p_cpo, CPO_SUBPERCENT) != NULL) { - if (old_sub == NULL) { /* there is no previous command */ - EMSG(_(e_nopresub)); - return; - } - sub = old_sub; - } else { - xfree(old_sub); - old_sub = vim_strsave(sub); - } + xfree(old_sub); + old_sub = vim_strsave(sub); } } else if (!eap->skip) { /* use previous pattern and substitution */ if (old_sub == NULL) { /* there is no previous command */ diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 3b6e05fd8a..fc7e2c9b44 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -6834,12 +6834,6 @@ void ex_cd(exarg_T *eap) { if (allbuf_locked()) return; - if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() - && !eap->forceit) { - EMSG(_( - "E747: Cannot change directory, buffer is modified (add ! to override)")); - return; - } /* ":cd -": Change to previous directory */ if (STRCMP(new_dir, "-") == 0) { diff --git a/src/nvim/memline.c b/src/nvim/memline.c index f11dc636a3..53f9a544b4 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -587,8 +587,7 @@ void ml_close(buf_T *buf, int del_file) void ml_close_all(int del_file) { FOR_ALL_BUFFERS(buf) { - ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0 - || vim_strchr(p_cpo, CPO_PRESERVE) == NULL)); + ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0)); } spell_delete_wordlist(); /* delete the internal wordlist */ vim_deltempdir(); /* delete created temp directory */ diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 7b445dcab6..a5eb54bb68 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -5735,22 +5735,10 @@ static void nv_optrans(cmdarg_T *cap) static char_u *str = (char_u *)"xXDCsSY&"; if (!checkclearopq(cap->oap)) { - /* In Vi "2D" doesn't delete the next line. Can't translate it - * either, because "2." should also not use the count. */ - if (cap->cmdchar == 'D' && vim_strchr(p_cpo, CPO_HASH) != NULL) { - cap->oap->start = curwin->w_cursor; - cap->oap->op_type = OP_DELETE; - set_op_var(OP_DELETE); - cap->count1 = 1; - nv_dollar(cap); - finish_op = true; - ResetRedobuff(); - AppendCharToRedobuff('D'); - } else { - if (cap->count0) - stuffnumReadbuff(cap->count0); - stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]); + if (cap->count0) { + stuffnumReadbuff(cap->count0); } + stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]); } cap->opcount = 0; } @@ -6548,9 +6536,6 @@ static void n_opencmd(cmdarg_T *cap) 0, 0)) { if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum) update_single_line(curwin, oldline); - /* When '#' is in 'cpoptions' ignore the count. */ - if (vim_strchr(p_cpo, CPO_HASH) != NULL) - cap->count1 = 1; invoke_edit(cap, false, cap->cmdchar, true); } } diff --git a/src/nvim/option.c b/src/nvim/option.c index 113c47f112..e76edcc672 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1724,12 +1724,6 @@ void set_init_1(void) /* Be nocompatible */ p_cp = FALSE; - /* Use POSIX compatibility when $VIM_POSIX is set. */ - if (os_env_exists("VIM_POSIX")) { - set_string_default("cpo", (char_u *)CPO_ALL); - set_string_default("shm", (char_u *)"A"); - } - /* * Find default value for 'shell' option. * Don't use it if it is empty. @@ -4226,7 +4220,7 @@ did_set_string_option ( if (varp == &p_shm) p = (char_u *)SHM_ALL; else if (varp == &(p_cpo)) - p = (char_u *)CPO_ALL; + p = (char_u *)CPO_VI; else if (varp == &(curbuf->b_p_fo)) p = (char_u *)FO_ALL; else if (varp == &curwin->w_p_cocu) diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index d1fe91f49c..e35f8bc55b 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -128,21 +128,11 @@ #define CPO_PLUS '+' /* ":write file" resets 'modified' */ #define CPO_SPECI '<' /* don't recognize <> in mappings */ #define CPO_REGAPPEND '>' /* insert NL when appending to a register */ -/* POSIX flags */ -#define CPO_HASH '#' /* "D", "o" and "O" do not use a count */ -#define CPO_PARA '{' /* "{" is also a paragraph boundary */ -#define CPO_TSIZE '|' /* $LINES and $COLUMNS overrule term size */ -#define CPO_PRESERVE '&' /* keep swap file after :preserve */ -#define CPO_SUBPERCENT '/' /* % in :s string uses previous one */ -#define CPO_BACKSL '\\' /* \ is not special in [] */ -#define CPO_CHDIR '.' /* don't chdir if buffer is modified */ #define CPO_SCOLON ';' /* using "," and ";" will skip over char if * cursor would not move */ -/* default values for Vim, Vi and POSIX */ +/* default values for Vim and Vi */ #define CPO_VIM "aABceFs" #define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" -#define CPO_ALL \ - "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>#{|&/\\.;" /* characters for p_ww option: */ #define WW_ALL "bshl<>[],~" diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 3ae3f46db3..4724a07895 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -1120,12 +1120,10 @@ static int get_coll_element(char_u **pp) } static int reg_cpo_lit; /* 'cpoptions' contains 'l' flag */ -static int reg_cpo_bsl; /* 'cpoptions' contains '\' flag */ static void get_cpo_flags(void) { reg_cpo_lit = vim_strchr(p_cpo, CPO_LITERAL) != NULL; - reg_cpo_bsl = vim_strchr(p_cpo, CPO_BACKSL) != NULL; } /* @@ -1149,7 +1147,6 @@ static char_u *skip_anyof(char_u *p) if (*p != ']' && *p != NUL) mb_ptr_adv(p); } else if (*p == '\\' - && !reg_cpo_bsl && (vim_strchr(REGEXP_INRANGE, p[1]) != NULL || (!reg_cpo_lit && vim_strchr(REGEXP_ABBR, p[1]) != NULL))) p += 2; @@ -2222,7 +2219,7 @@ collection: } /* Handle \o40, \x20 and \u20AC style sequences */ - if (endc == '\\' && !reg_cpo_lit && !reg_cpo_bsl) + if (endc == '\\' && !reg_cpo_lit) endc = coll_get_char(); if (startc > endc) @@ -2245,10 +2242,8 @@ collection: * Only "\]", "\^", "\]" and "\\" are special in Vi. Vim * accepts "\t", "\e", etc., but only when the 'l' flag in * 'cpoptions' is not included. - * Posix doesn't recognize backslash at all. */ else if (*regparse == '\\' - && !reg_cpo_bsl && (vim_strchr(REGEXP_INRANGE, regparse[1]) != NULL || (!reg_cpo_lit && vim_strchr(REGEXP_ABBR, diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index d9dc09b623..42cebb0198 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -1584,10 +1584,8 @@ collection: * Only "\]", "\^", "\]" and "\\" are special in Vi. Vim * accepts "\t", "\e", etc., but only when the 'l' flag in * 'cpoptions' is not included. - * Posix doesn't recognize backslash at all. */ if (*regparse == '\\' - && !reg_cpo_bsl && regparse + 1 <= endp && (vim_strchr(REGEXP_INRANGE, regparse[1]) != NULL || (!reg_cpo_lit diff --git a/src/nvim/search.c b/src/nvim/search.c index e10504973b..f91ac3bb9c 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -2199,7 +2199,6 @@ findpar ( linenr_T curr; bool did_skip; /* true after separating lines have been skipped */ bool first; /* true on first line */ - int posix = (vim_strchr(p_cpo, CPO_PARA) != NULL); linenr_T fold_first; /* first line of a closed fold */ linenr_T fold_last; /* last line of a closed fold */ bool fold_skipped; /* true if a closed fold was skipped this @@ -2220,12 +2219,7 @@ findpar ( fold_skipped = true; } - /* POSIX has it's own ideas of what a paragraph boundary is and it - * doesn't match historical Vi: It also stops at a "{" in the - * first column and at an empty line. */ - if (!first && did_skip && (startPS(curr, what, both) - || (posix && what == NUL && *ml_get(curr) == - '{'))) + if (!first && did_skip && startPS(curr, what, both)) break; if (fold_skipped) diff --git a/src/nvim/testdir/test79.in b/src/nvim/testdir/test79.in Binary files differindex 8278bd8000..afbf2083d2 100644 --- a/src/nvim/testdir/test79.in +++ b/src/nvim/testdir/test79.in diff --git a/src/nvim/testdir/test79.ok b/src/nvim/testdir/test79.ok Binary files differindex e22eee0b71..d4e0ae8819 100644 --- a/src/nvim/testdir/test79.ok +++ b/src/nvim/testdir/test79.ok diff --git a/src/nvim/testdir/test80.in b/src/nvim/testdir/test80.in index 406fb6dac7..e0bcb0114b 100644 --- a/src/nvim/testdir/test80.in +++ b/src/nvim/testdir/test80.in @@ -126,10 +126,6 @@ TEST_6: STARTTEST :set magic& :$put =\"\n\nTEST_6:\" -:set cpo+=/ -:$put =substitute('A', 'A', 'a', '') -:$put =substitute('B', 'B', '%', '') -:set cpo-=/ :$put =substitute('C', 'C', 'c', '') :$put =substitute('D', 'D', '%', '') /^TEST_7 diff --git a/src/nvim/testdir/test80.ok b/src/nvim/testdir/test80.ok index b42f604a07..157a42dfc1 100644 --- a/src/nvim/testdir/test80.ok +++ b/src/nvim/testdir/test80.ok @@ -94,8 +94,6 @@ A123456789987654321 TEST_6: -a -% c % |