diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 4dd515f3e0..813d741f5d 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -714,9 +714,6 @@ When the {string} starts with "\=" it is evaluated as an expression, see characters. Otherwise these characters in {string} have a special meaning: - *:s%* -When {string} is equal to "%" and '/' is included with the 'cpoptions' option, -then the {string} of the previous substitute command is used, see |cpo-/| magic nomagic action ~ & \& replaced with the whole matched pattern *s/\&* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index f6c34519e6..b166079985 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1952,9 +1952,6 @@ A jump table for the options with a short description can be found at |Q_op|. '\' included: "/[ \-]" finds , '\' and '-' '\' excluded: "/[ \-]" finds and '-' Also see |cpo-l|. - *cpo-/* - / When "%" is used as the replacement string in a |:s| - command, use the previous replacement string. |:s%| *cpo-.* . The ":chdir" and ":cd" commands fail if the current buffer is modified, unless ! is used. Vim doesn't 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 %