Skip to content

Commit

Permalink
Make the argument of vi-mode's motion optional (ref lem-project#1021).
Browse files Browse the repository at this point in the history
  • Loading branch information
fukamachi committed Aug 29, 2023
1 parent 6027dd2 commit c51cbb7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions extensions/vi-mode/commands.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,22 @@
(return)
(character-offset p -1)))))

(define-motion vi-next-line (n) ("p")
(define-motion vi-next-line (&optional (n 1)) ("p")
(:type :line)
(next-logical-line n)
(fall-within-line (current-point)))

(define-motion vi-next-display-line (n) ("p")
(define-motion vi-next-display-line (&optional (n 1)) ("p")
(:type :line)
(next-line n)
(fall-within-line (current-point)))

(define-motion vi-previous-line (n) ("p")
(define-motion vi-previous-line (&optional (n 1)) ("p")
(:type :line)
(previous-logical-line n)
(fall-within-line (current-point)))

(define-motion vi-previous-display-line (n) ("p")
(define-motion vi-previous-display-line (&optional (n 1)) ("p")
(:type :line)
(previous-line n)
(fall-within-line (current-point)))
Expand Down Expand Up @@ -192,7 +192,7 @@
(dotimes (i n)
(backward-word-begin #'word-char-type)))

(define-motion vi-forward-word-end (n) ("p")
(define-motion vi-forward-word-end (&optional (n 1)) ("p")
(:type :inclusive)
(dotimes (i n)
(forward-word-end #'word-char-type)))
Expand All @@ -205,7 +205,7 @@
(dotimes (i n)
(backward-word-begin #'broad-word-char-type)))

(define-motion vi-forward-word-end-broad (n) ("p")
(define-motion vi-forward-word-end-broad (&optional (n 1)) ("p")
(:type :inclusive)
(dotimes (i n)
(forward-word-end #'broad-word-char-type)))
Expand Down Expand Up @@ -328,7 +328,7 @@
(vi-change beg end type)
(change-state 'insert))

(define-motion vi-line (n) ("p")
(define-motion vi-line (&optional (n 1)) ("p")
()
(next-logical-line (1- n)))

Expand Down Expand Up @@ -568,7 +568,7 @@
(move-to-beginning-of-buffer)
(skip-whitespace-forward (current-point) t))

(define-motion vi-goto-line (n) ("P")
(define-motion vi-goto-line (&optional n) ("P")
(:type :line
:jump t)
(if (null n)
Expand Down Expand Up @@ -610,32 +610,32 @@
(character-offset p offset)
(move-point (current-point) p)))))

(define-motion vi-find-char (n) ("p")
(define-motion vi-find-char (&optional (n 1)) ("p")
(:type :inclusive)
(alexandria:when-let (c (key-to-char (read-key)))
(%vi-find-char n c :forward -1)))

(define-motion vi-find-char-backward (n) ("p")
(define-motion vi-find-char-backward (&optional (n 1)) ("p")
()
(alexandria:when-let (c (key-to-char (read-key)))
(%vi-find-char n c :backward 0)))

(define-motion vi-find-char-before (n) ("p")
(define-motion vi-find-char-before (&optional (n 1)) ("p")
(:type :inclusive)
(alexandria:when-let (c (key-to-char (read-key)))
(%vi-find-char n c :forward -2)))

(define-motion vi-find-char-backward-after (n) ("p")
(define-motion vi-find-char-backward-after (&optional (n 1)) ("p")
()
(alexandria:when-let (c (key-to-char (read-key)))
(%vi-find-char n c :backward 1)))

(define-motion vi-find-char-repeat (n) ("p")
(define-motion vi-find-char-repeat (&optional (n 1)) ("p")
(:type :inclusive)
(when *find-char-args*
(apply #'%vi-find-char n *find-char-args*)))

(define-motion vi-find-char-repeat-backward (n) ("p")
(define-motion vi-find-char-repeat-backward (&optional (n 1)) ("p")
()
(when *find-char-args*
(destructuring-bind (c direction offset)
Expand Down

0 comments on commit c51cbb7

Please sign in to comment.