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

From: Matias Linares <matiaslina_AT_opmbx.org>
Date: Fri, 3 Apr 2015 15:14:49 -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 | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/vis.c b/vis.c
index 11cf1af..d18948a 100644
--- a/vis.c
+++ b/vis.c
_AT_@ -556,6 +556,13 @@ static void op_delete(OperatorContext *c) {
 }
 
 static void op_change(OperatorContext *c) {
+	if(action.movement->txt == text_word_start_next) {
+		action.movement->txt = text_word_end_next;
+		action.movement->type |= INCLUSIVE;
+	} else if(action.movement->txt == text_longword_start_next) {
+		action.movement->txt = text_longword_end_next;
+		action.movement->type |= INCLUSIVE;
+	}
 	op_delete(c);
 	switchmode(&(const Arg){ .i = VIS_MODE_INSERT });
 }
-- 
2.3.5
Received on Fri Apr 03 2015 - 20:14:49 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 03 2015 - 20:24:08 CEST