aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-10-09 22:35:23 +0000
committerSimon Ruderich <simon@ruderich.org>2010-10-09 22:35:23 +0000
commita89e3f5572c010a02a498a542affb0c014c2807e (patch)
treee295f05aff9b6d474251b83bc0508a166066c2d4 /vim-mode
parentMerge remote branch 'origin/dev' (diff)
downloadirssi-scripts-a89e3f5572c010a02a498a542affb0c014c2807e.tar.gz
irssi-scripts-a89e3f5572c010a02a498a542affb0c014c2807e.zip
vim_mode: Support counts with mapped ex-commands.
Diffstat (limited to 'vim-mode')
-rw-r--r--vim-mode/vim_mode.pl14
1 files 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<esc>
+# Counts and combinations work as well, e.g. d5fx or 3iabc<esc>. 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) {