From 7ed085ee686b1e022e47495ef3534532a07659dd Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 26 Sep 2010 22:35:37 +0200 Subject: vim_mode: Implement skipping of movement/operator. Used by . after startup. --- vim-mode/vim_mode.pl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'vim-mode') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 141c836..1c67c0c 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -183,7 +183,7 @@ my $movements 'P' => { func => \&cmd_movement_P }, # misc '~' => { func => \&cmd_movement_tilde }, - '.' => { func => \&cmd_movement_dot }, + '.' => {}, }; # special movements which take an additional key @@ -504,10 +504,6 @@ sub cmd_movement_tilde { _input($input); _input_pos($pos + $count); } -sub cmd_movement_dot { - # Does nothing. Necessary to prevent errors when pressing . before running - # any commands (at irssi startup). -} sub cmd_ex_command { my $arg_str = join '', @ex_buf; @@ -691,6 +687,8 @@ sub handle_command { } elsif ($movement || exists $movements->{$char}) { print "Processing movement command: $char" if DEBUG; + my $skip = 0; + # . repeats the last command. if ($char eq '.' and !$movement and defined $last->{char}) { $char = $last->{char}; @@ -700,9 +698,13 @@ sub handle_command { } $operator = $last->{operator}; $movement = $last->{movement}; + } elsif ($char eq '.') { + $skip = 1; } - if (1) { + if ($skip) { + print "Skipping movement and operator." if DEBUG; + } else { $numeric_prefix = 1 if not $numeric_prefix; # Execute the movement (multiple times). -- cgit v1.2.3