From 727c926432129b3bb803331040b6b458fc20d51e Mon Sep 17 00:00:00 2001 From: naryl <> Date: Mon, 21 Oct 2024 18:28:06 +0300 Subject: [PATCH 1/2] cw should be a synonym to ce --- extensions/vi-mode/commands.lisp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/extensions/vi-mode/commands.lisp b/extensions/vi-mode/commands.lisp index b377b91e3..5d2b1d9bd 100644 --- a/extensions/vi-mode/commands.lisp +++ b/extensions/vi-mode/commands.lisp @@ -433,15 +433,18 @@ Move the cursor to the first non-blank character of the line." (when (point= beg end) (return-from vi-change)) (let ((end-with-newline (char= (character-at end -1) #\Newline))) - (vi-delete beg end type) - (when (eq type :line) - (cond - (end-with-newline - (insert-character (current-point) #\Newline) - (character-offset (current-point) -1)) - (t - (insert-character (current-point) #\Newline))) - (indent-line (current-point)))) + (case type + (:line + (vi-delete beg end type) + (cond + (end-with-newline + (insert-character (current-point) #\Newline) + (character-offset (current-point) -1)) + (t + (insert-character (current-point) #\Newline))) + (indent-line (current-point))) + (t (skip-whitespace-backward end) + (vi-delete beg end type)))) (change-state 'insert)) (define-operator vi-change-whole-line (beg end) ("") From 9b446bda8a3fdb2be3830defdc6d410c43ec7aa8 Mon Sep 17 00:00:00 2001 From: naryl <> Date: Mon, 21 Oct 2024 18:32:06 +0300 Subject: [PATCH 2/2] ... only on non-whitespace character --- extensions/vi-mode/commands.lisp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/vi-mode/commands.lisp b/extensions/vi-mode/commands.lisp index 5d2b1d9bd..42d1eddc4 100644 --- a/extensions/vi-mode/commands.lisp +++ b/extensions/vi-mode/commands.lisp @@ -443,7 +443,8 @@ Move the cursor to the first non-blank character of the line." (t (insert-character (current-point) #\Newline))) (indent-line (current-point))) - (t (skip-whitespace-backward end) + (t (unless (eql (character-at (current-point)) #\Space) + (skip-whitespace-backward end)) (vi-delete beg end type)))) (change-state 'insert))