diff --git a/private/commands.rkt b/private/commands.rkt index 93249de..7eca65d 100644 --- a/private/commands.rkt +++ b/private/commands.rkt @@ -13,7 +13,8 @@ (struct-out repeat-command) (struct-out repeat-motion) (struct-out replace-command) - (struct-out goto-command)) + (struct-out goto-command) + movement-command?) ;; A Command is one of ;; - Symbol @@ -261,3 +262,16 @@ [#\" 'double-quote] [(or #\space #\l) 'right] [_ #f])) + +;; check if the given command is a movement command +(define (movement-command? command) + (or (goto-command? command) + (memq command + '(left down up right + next-page previous-page + next-word previous-word + continue + start-of-line end-of-line + start-of-line-content + match + start-of-file end-of-file)))) diff --git a/private/text.rkt b/private/text.rkt index dd42543..09204ec 100644 --- a/private/text.rkt +++ b/private/text.rkt @@ -400,7 +400,8 @@ (scroll-to-position pos)] [_ (handle-simple-command command)]) - (unless (eq? command 'single-repeat) + (unless (or (eq? command 'single-repeat) + (movement-command? command)) (set! last-command command))) ;; handle a command with no motion/repeat diff --git a/tests/unit-tests.rkt b/tests/unit-tests.rkt index de4c0a6..85d2667 100644 --- a/tests/unit-tests.rkt +++ b/tests/unit-tests.rkt @@ -827,6 +827,12 @@ '(#\d #\a #\w #\.) @~a{}) +;; Issue #108, "." on movement +(check-vim + @~a{foo bar} + '(#\x #\l #\.) + @~a{o bar}) + ;; Issue #88, "~" (check-vim @~a{fOo bar}