From a89e3f5572c010a02a498a542affb0c014c2807e Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 10 Oct 2010 00:35:23 +0200 Subject: vim_mode: Support counts with mapped ex-commands. --- vim-mode/vim_mode.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 9d8e04b..fad440a 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -49,7 +49,9 @@ # * Switch split windows: Ctrl-W j Ctrl-W k # * Undo/Redo: u Ctrl-R # -# Counts and combinations work as well, e.g. d5fx or 3iabc +# Counts and combinations work as well, e.g. d5fx or 3iabc. Counts also +# work with mapped ex-commands (see below), e.g. if you map gb to do :bn, then +# 2gb will switch to the second next buffer. # Repeat also supports counts. # # The following insert mode mappings are supported: @@ -2121,7 +2123,15 @@ sub handle_command_cmd { # ex-mode command doesn't need any additional arguments. if ($cmd->{type} == C_EX) { print "Processing ex-command: $map->{char} ($cmd->{char})" if DEBUG; - $cmd->{func}->(substr $cmd->{char}, 1); + + if (not $numeric_prefix) { + $numeric_prefix = 1; + } + while ($numeric_prefix-- > 0) { + $cmd->{func}->(substr $cmd->{char}, 1); + } + $numeric_prefix = undef; + return 1; # call _stop() # As can irssi commands. } elsif ($cmd->{type} == C_IRSSI) { -- cgit v1.2.3