[dev] [vis] [PATCH] Change behaviour of 'cw' and 'cW'

From: Matias Linares <matiaslina_AT_opmbx.org>
Date: Fri, 3 Apr 2015 21:27:12 -0300

from vim's help:

cw cW
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
because Vim interprets "cw" as change-word, and a word does not include the
following white space.
---
 vis.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/vis.c b/vis.c
index 11cf1af..2057ffe 100644
--- a/vis.c
+++ b/vis.c
_AT_@ -952,6 +952,14 @@ static void movement(const Arg *arg) {
 		action.textobj = moves_linewise[arg->i];
 	else
 		action.movement = &moves[arg->i];
+
+	if (action.op == &ops[OP_CHANGE]) {
+		if (action.movement == &moves[MOVE_WORD_START_NEXT])
+			action.movement = &moves[MOVE_WORD_END_NEXT];
+		else if (action.movement == &moves[MOVE_LONGWORD_START_NEXT])
+			action.movement = &moves[MOVE_LONGWORD_END_NEXT];
+	}
+
 	action_do(&action);
 }
 
-- 
2.3.5
Received on Sat Apr 04 2015 - 02:27:12 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 04 2015 - 02:36:08 CEST