Skip to content

Commit

Permalink
feature: add vi-swapcase-and-forward-char command for vi-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sakurawald committed Nov 22, 2024
1 parent ff01fec commit 289b8e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions extensions/vi-mode/binds.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
(define-key *normal-keymap* "g U" 'vi-upcase)
(define-key *normal-keymap* "g u" 'vi-downcase)
(define-key *normal-keymap* "g ~" 'vi-swapcase)
(define-key *normal-keymap* "~" 'vi-swapcase-and-forward-char)
(define-key *normal-keymap* "u" 'vi-undo)
(define-key *normal-keymap* "C-r" 'vi-redo)
(define-key *motion-keymap* 'delete-previous-char 'vi-backward-char)
Expand Down
7 changes: 7 additions & 0 deletions extensions/vi-mode/commands.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
:vi-upcase
:vi-downcase
:vi-swapcase
:vi-swapcase-and-forward-char
:vi-undo
:vi-redo
:vi-record-macro
Expand Down Expand Up @@ -639,6 +640,12 @@ Move the cursor to the first non-blank character of the line."
(apply-visual-range #'swapcase-region)
(swapcase-region start end))))

(define-command vi-swapcase-and-forward-char () ()
(let* ((start (copy-point (current-point)))
(end (character-offset (current-point) 1)))
(vi-swapcase start end (current-state)))
(vi-forward-char))

(define-command vi-undo (&optional (n 1)) (:universal)
(undo n))

Expand Down

0 comments on commit 289b8e4

Please sign in to comment.