From 40ef612ce45e0c8acd6e6a2183e7d4241a4b48df Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 1 Oct 2010 16:40:52 +0200 Subject: vim_mode: Store repeatable "movements" in hash. --- vim-mode/vim_mode.pl | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 2b771b3..487779d 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -337,6 +337,24 @@ my $movements_multiple = "\x17" => undef, # ctrl-w }; +# "movements" which can be repeated (additional to operators of course). +my $movements_repeatable + = { + 'x' => undef, + 'X' => undef, + 'r' => undef, + 'p' => undef, + 'P' => undef, + 'C' => undef, + 'D' => undef, + '~' => undef, + '"' => undef, + 'i' => undef, + 'a' => undef, + 'I' => undef, + 'A' => undef, + }; + sub cmd_undo { print "Undo!" if DEBUG; @@ -1435,13 +1453,8 @@ sub handle_command_cmd { $repeat); } - # Store command, necessary for . But ignore movements and - # registers. - if ($operator or $char eq 'x' or $char eq 'X' or $char eq 'r' or - $char eq 'p' or $char eq 'P' or $char eq 'C' or - $char eq 'D' or $char eq '~' or $char eq '"' or - $char eq 'i' or $char eq 'I' or $char eq 'a' or - $char eq 'A') { + # Store command, necessary for . + if ($operator or exists $movements_repeatable->{$char}) { $last->{char} = $char; $last->{numeric_prefix} = $numeric_prefix; $last->{operator} = $operator; -- cgit v1.2.3