diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/normal.c | 41 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 5 |
2 files changed, 14 insertions, 32 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index b122b3e1d5..b7f2666968 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -6714,35 +6714,18 @@ static void nv_wordcmd(cmdarg_T *cap) */ if (!word_end && cap->oap->op_type == OP_CHANGE) { n = gchar_cursor(); - if (n != NUL) { /* not an empty line */ - if (ascii_iswhite(n)) { - /* - * Reproduce a funny Vi behaviour: "cw" on a blank only - * changes one character, not all blanks until the start of - * the next word. Only do this when the 'w' flag is included - * in 'cpoptions'. - */ - if (cap->count1 == 1 && vim_strchr(p_cpo, CPO_CW) != NULL) { - cap->oap->inclusive = true; - cap->oap->motion_type = MCHAR; - return; - } - } 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; - } + if (n != NUL && !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 + // 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; } } diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index cb2a36df4d..e40234f671 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -119,7 +119,6 @@ #define CPO_TAGPAT 't' #define CPO_UNDO 'u' /* "u" undoes itself */ #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_ESC 'x' #define CPO_REPLCNT 'X' /* "R" with a count only deletes chars once */ @@ -145,9 +144,9 @@ * cursor would not move */ /* default values for Vim, Vi and POSIX */ #define CPO_VIM "aABceFs" -#define CPO_VI "aAbBcCdDeEfFHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>;" +#define CPO_VI "aAbBcCdDeEfFHiIjJkKlLmMnoOpPqrRsStuvWxXyZ$!%*-+<>;" #define CPO_ALL \ - "aAbBcCdDeEfFHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>#{|&/\\.;" + "aAbBcCdDeEfFHiIjJkKlLmMnoOpPqrRsStuvWxXyZ$!%*-+<>#{|&/\\.;" /* characters for p_ww option: */ #define WW_ALL "bshl<>[],~" |