From 96c27692b8e58a48e094cf5747dd51b26db75d39 Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Fri, 3 Jul 2015 03:10:34 -0400 Subject: Remove POSIX 'cpoptions': '#' --- src/nvim/normal.c | 21 +++------------------ src/nvim/option_defs.h | 3 +-- 2 files changed, 4 insertions(+), 20 deletions(-) (limited to 'src') 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_defs.h b/src/nvim/option_defs.h index d1fe91f49c..2afcc3dfa0 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -129,7 +129,6 @@ #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 */ @@ -142,7 +141,7 @@ #define CPO_VIM "aABceFs" #define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" #define CPO_ALL \ - "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>#{|&/\\.;" + "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>{|&/\\.;" /* characters for p_ww option: */ #define WW_ALL "bshl<>[],~" -- cgit From 4a86122422e1e6cdedf5e4d99df9ea719793f367 Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Fri, 3 Jul 2015 03:21:59 -0400 Subject: Remove POSIX 'cpoptions': '{' --- src/nvim/option_defs.h | 3 +-- src/nvim/search.c | 8 +------- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 2afcc3dfa0..e292f44b9a 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -129,7 +129,6 @@ #define CPO_SPECI '<' /* don't recognize <> in mappings */ #define CPO_REGAPPEND '>' /* insert NL when appending to a register */ /* POSIX flags */ -#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 */ @@ -141,7 +140,7 @@ #define CPO_VIM "aABceFs" #define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" #define CPO_ALL \ - "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>{|&/\\.;" + "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>|&/\\.;" /* characters for p_ww option: */ #define WW_ALL "bshl<>[],~" 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) -- cgit From d9b053d6a6fe95d230004c4c75d91a5e87119259 Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Fri, 3 Jul 2015 03:25:00 -0400 Subject: Remove POSIX 'cpoptions': '|' It wasn't even hooked up to anything... must have been removed when term.c was replaced. --- src/nvim/option_defs.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index e292f44b9a..3d59a28e04 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -129,7 +129,6 @@ #define CPO_SPECI '<' /* don't recognize <> in mappings */ #define CPO_REGAPPEND '>' /* insert NL when appending to a register */ /* POSIX flags */ -#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 [] */ @@ -140,7 +139,7 @@ #define CPO_VIM "aABceFs" #define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" #define CPO_ALL \ - "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>|&/\\.;" + "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>&/\\.;" /* characters for p_ww option: */ #define WW_ALL "bshl<>[],~" -- cgit From b19afa52c4ee679f62b5e7679694241f9a09ccba Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Fri, 3 Jul 2015 03:35:39 -0400 Subject: Remove POSIX 'cpoptions': '&' --- src/nvim/memline.c | 3 +-- src/nvim/option_defs.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') 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/option_defs.h b/src/nvim/option_defs.h index 3d59a28e04..02a16a1a60 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -129,7 +129,6 @@ #define CPO_SPECI '<' /* don't recognize <> in mappings */ #define CPO_REGAPPEND '>' /* insert NL when appending to a register */ /* POSIX flags */ -#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 */ @@ -139,7 +138,7 @@ #define CPO_VIM "aABceFs" #define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" #define CPO_ALL \ - "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>&/\\.;" + "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>/\\.;" /* characters for p_ww option: */ #define WW_ALL "bshl<>[],~" -- cgit From 3931a36340b71f2c3b7ea65132176fda77fe36c4 Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Fri, 3 Jul 2015 05:18:05 -0400 Subject: Remove POSIX 'cpoptions': '/' --- src/nvim/ex_cmds.c | 14 ++------------ src/nvim/option_defs.h | 3 +-- src/nvim/testdir/test79.in | Bin 3381 -> 3335 bytes src/nvim/testdir/test79.ok | Bin 574 -> 570 bytes src/nvim/testdir/test80.in | 4 ---- src/nvim/testdir/test80.ok | 2 -- 6 files changed, 3 insertions(+), 20 deletions(-) (limited to 'src') 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/option_defs.h b/src/nvim/option_defs.h index 02a16a1a60..a8f26a7c3d 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -129,7 +129,6 @@ #define CPO_SPECI '<' /* don't recognize <> in mappings */ #define CPO_REGAPPEND '>' /* insert NL when appending to a register */ /* POSIX flags */ -#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 @@ -138,7 +137,7 @@ #define CPO_VIM "aABceFs" #define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" #define CPO_ALL \ - "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>/\\.;" + "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>\\.;" /* characters for p_ww option: */ #define WW_ALL "bshl<>[],~" diff --git a/src/nvim/testdir/test79.in b/src/nvim/testdir/test79.in index 8278bd8000..afbf2083d2 100644 Binary files a/src/nvim/testdir/test79.in and b/src/nvim/testdir/test79.in differ diff --git a/src/nvim/testdir/test79.ok b/src/nvim/testdir/test79.ok index e22eee0b71..d4e0ae8819 100644 Binary files a/src/nvim/testdir/test79.ok and b/src/nvim/testdir/test79.ok differ 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 % -- cgit From 0661411bbaa547b9ddd9fde8ed40ca9cb0dcfcae Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Fri, 3 Jul 2015 05:23:26 -0400 Subject: Remove POSIX 'cpoptions': '.' --- src/nvim/ex_docmd.c | 6 ------ src/nvim/option_defs.h | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'src') 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/option_defs.h b/src/nvim/option_defs.h index a8f26a7c3d..e73cc4c189 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -130,14 +130,13 @@ #define CPO_REGAPPEND '>' /* insert NL when appending to a register */ /* POSIX flags */ #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 */ #define CPO_VIM "aABceFs" #define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" #define CPO_ALL \ - "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>\\.;" + "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>\\;" /* characters for p_ww option: */ #define WW_ALL "bshl<>[],~" -- cgit From 4f444ae4f8813a1193dd831049d19f86b5128e93 Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Fri, 3 Jul 2015 05:29:15 -0400 Subject: Remove POSIX 'cpoptions': '\' --- src/nvim/option_defs.h | 3 +-- src/nvim/regexp.c | 7 +------ src/nvim/regexp_nfa.c | 2 -- 3 files changed, 2 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index e73cc4c189..a6b2c3bd6f 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -129,14 +129,13 @@ #define CPO_SPECI '<' /* don't recognize <> in mappings */ #define CPO_REGAPPEND '>' /* insert NL when appending to a register */ /* POSIX flags */ -#define CPO_BACKSL '\\' /* \ is not special in [] */ #define CPO_SCOLON ';' /* using "," and ";" will skip over char if * cursor would not move */ /* default values for Vim, Vi and POSIX */ #define CPO_VIM "aABceFs" #define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" #define CPO_ALL \ - "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>\\;" + "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 -- cgit From 85b7ea9a8770c42bf2cadb1d3fa605b58d82d7cb Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Fri, 3 Jul 2015 05:33:48 -0400 Subject: Remove POSIX 'cpoptions': cleanup - CPO_ALL and CPO_VI are identical, so merge them - No longer check for the environment variable 'VIM_POSIX' - In vim_diff.txt, mention the removal of 'cpoptions' flags --- src/nvim/option.c | 8 +------- src/nvim/option_defs.h | 5 +---- 2 files changed, 2 insertions(+), 11 deletions(-) (limited to 'src') 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 a6b2c3bd6f..e35f8bc55b 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -128,14 +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_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<>[],~" -- cgit