mirror of
https://github.com/neovim/neovim.git
synced 2025-09-20 02:08:17 +00:00
'cpoptions': Remove "w" flag #2507
This commit is contained in:

committed by
Justin M. Keyes

parent
b85db92d7f
commit
4230f8c332
@@ -248,9 +248,6 @@ Special case: When the cursor is in a word, "cw" and "cW" do not include the
|
|||||||
white space after a word, they only change up to the end of the word. This is
|
white space after a word, they only change up to the end of the word. This is
|
||||||
because Vim interprets "cw" as change-word, and a word does not include the
|
because Vim interprets "cw" as change-word, and a word does not include the
|
||||||
following white space.
|
following white space.
|
||||||
{Vi: "cw" when on a blank followed by other blanks changes only the first
|
|
||||||
blank; this is probably a bug, because "dw" deletes all the blanks; use the
|
|
||||||
'w' flag in 'cpoptions' to make it work like Vi anyway}
|
|
||||||
|
|
||||||
If you prefer "cw" to include the space after a word, use this mapping: >
|
If you prefer "cw" to include the space after a word, use this mapping: >
|
||||||
:map cw dwi
|
:map cw dwi
|
||||||
|
@@ -409,9 +409,7 @@ WORD before the fold.
|
|||||||
|
|
||||||
Special case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is
|
Special case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is
|
||||||
on a non-blank. This is because "cw" is interpreted as change-word, and a
|
on a non-blank. This is because "cw" is interpreted as change-word, and a
|
||||||
word does not include the following white space. {Vi: "cw" when on a blank
|
word does not include the following white space.
|
||||||
followed by other blanks changes only the first blank; this is probably a
|
|
||||||
bug, because "dw" deletes all the blanks}
|
|
||||||
|
|
||||||
Another special case: When using the "w" motion in combination with an
|
Another special case: When using the "w" motion in combination with an
|
||||||
operator and the last word moved over is at the end of a line, the end of
|
operator and the last word moved over is at the end of a line, the end of
|
||||||
|
@@ -1945,10 +1945,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
erased from the screen right away. With this flag the
|
erased from the screen right away. With this flag the
|
||||||
screen newly typed text overwrites backspaced
|
screen newly typed text overwrites backspaced
|
||||||
characters.
|
characters.
|
||||||
*cpo-w*
|
|
||||||
w When using "cw" on a blank character, only change one
|
|
||||||
character and not all blanks until the start of the
|
|
||||||
next word.
|
|
||||||
*cpo-W*
|
*cpo-W*
|
||||||
W Don't overwrite a readonly file. When omitted, ":w!"
|
W Don't overwrite a readonly file. When omitted, ":w!"
|
||||||
overwrites a readonly file, if possible.
|
overwrites a readonly file, if possible.
|
||||||
|
@@ -6714,35 +6714,18 @@ static void nv_wordcmd(cmdarg_T *cap)
|
|||||||
*/
|
*/
|
||||||
if (!word_end && cap->oap->op_type == OP_CHANGE) {
|
if (!word_end && cap->oap->op_type == OP_CHANGE) {
|
||||||
n = gchar_cursor();
|
n = gchar_cursor();
|
||||||
if (n != NUL) { /* not an empty line */
|
if (n != NUL && !ascii_iswhite(n)) {
|
||||||
if (ascii_iswhite(n)) {
|
// This is a little strange. To match what the real Vi does, we
|
||||||
/*
|
// effectively map "cw" to "ce", and "cW" to "cE", provided that we are
|
||||||
* Reproduce a funny Vi behaviour: "cw" on a blank only
|
// not on a space or a TAB. This seems impolite at first, but it's
|
||||||
* changes one character, not all blanks until the start of
|
// really more what we mean when we say "cw".
|
||||||
* the next word. Only do this when the 'w' flag is included
|
//
|
||||||
* in 'cpoptions'.
|
// Another strangeness: When standing on the end of a word "ce" will
|
||||||
*/
|
// change until the end of the next word, but "cw" will change only one
|
||||||
if (cap->count1 == 1 && vim_strchr(p_cpo, CPO_CW) != NULL) {
|
// character! This is done by setting "flag".
|
||||||
cap->oap->inclusive = true;
|
cap->oap->inclusive = true;
|
||||||
cap->oap->motion_type = MCHAR;
|
word_end = true;
|
||||||
return;
|
flag = true;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* This is a little strange. To match what the real Vi does,
|
|
||||||
* we effectively map 'cw' to 'ce', and 'cW' to 'cE', provided
|
|
||||||
* that we are not on a space or a TAB. This seems impolite
|
|
||||||
* at first, but it's really more what we mean when we say
|
|
||||||
* 'cw'.
|
|
||||||
* Another strangeness: When standing on the end of a word
|
|
||||||
* "ce" will change until the end of the next word, but "cw"
|
|
||||||
* will change only one character! This is done by setting
|
|
||||||
* flag.
|
|
||||||
*/
|
|
||||||
cap->oap->inclusive = true;
|
|
||||||
word_end = true;
|
|
||||||
flag = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -119,7 +119,6 @@
|
|||||||
#define CPO_TAGPAT 't'
|
#define CPO_TAGPAT 't'
|
||||||
#define CPO_UNDO 'u' /* "u" undoes itself */
|
#define CPO_UNDO 'u' /* "u" undoes itself */
|
||||||
#define CPO_BACKSPACE 'v' /* "v" keep deleted text */
|
#define CPO_BACKSPACE 'v' /* "v" keep deleted text */
|
||||||
#define CPO_CW 'w' /* "cw" only changes one blank */
|
|
||||||
#define CPO_FWRITE 'W' /* "w!" doesn't overwrite readonly files */
|
#define CPO_FWRITE 'W' /* "w!" doesn't overwrite readonly files */
|
||||||
#define CPO_ESC 'x'
|
#define CPO_ESC 'x'
|
||||||
#define CPO_REPLCNT 'X' /* "R" with a count only deletes chars once */
|
#define CPO_REPLCNT 'X' /* "R" with a count only deletes chars once */
|
||||||
@@ -145,9 +144,9 @@
|
|||||||
* cursor would not move */
|
* cursor would not move */
|
||||||
/* default values for Vim, Vi and POSIX */
|
/* default values for Vim, Vi and POSIX */
|
||||||
#define CPO_VIM "aABceFs"
|
#define CPO_VIM "aABceFs"
|
||||||
#define CPO_VI "aAbBcCdDeEfFHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>;"
|
#define CPO_VI "aAbBcCdDeEfFHiIjJkKlLmMnoOpPqrRsStuvWxXyZ$!%*-+<>;"
|
||||||
#define CPO_ALL \
|
#define CPO_ALL \
|
||||||
"aAbBcCdDeEfFHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>#{|&/\\.;"
|
"aAbBcCdDeEfFHiIjJkKlLmMnoOpPqrRsStuvWxXyZ$!%*-+<>#{|&/\\.;"
|
||||||
|
|
||||||
/* characters for p_ww option: */
|
/* characters for p_ww option: */
|
||||||
#define WW_ALL "bshl<>[],~"
|
#define WW_ALL "bshl<>[],~"
|
||||||
|
Reference in New Issue
Block a user