Skip to content

Commit

Permalink
Merge pull request #1575 from naryl/vi-fixes
Browse files Browse the repository at this point in the history
cw should be a synonym to ce
  • Loading branch information
cxxxr authored Oct 21, 2024
2 parents df72d8a + 9b446bd commit 39fdfd8
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions extensions/vi-mode/commands.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,19 @@ 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 (unless (eql (character-at (current-point)) #\Space)
(skip-whitespace-backward end))
(vi-delete beg end type))))
(change-state 'insert))

(define-operator vi-change-whole-line (beg end) ("<r>")
Expand Down

0 comments on commit 39fdfd8

Please sign in to comment.