From 15d5c53ccad7b09aaeda2029c9958d9853016a14 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 1 Oct 2010 15:21:29 +0200 Subject: vim_mode: Add Ctrl-W j/k to switch to split windows. --- vim-mode/vim_mode.pl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'vim-mode') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 5d918ef..006f2b3 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -18,7 +18,7 @@ # * repeat ftFT: ; , # * change/change/yank line: cc dd yy S # * Combinations like in Vi, e.g. d5fx -# * window selection: :b, :b#, :b :bn :bp +# * window selection: :b, :b#, :b :bn :bp Ctrl-W j/k # # * special registers: "* "+ (contain irssi's cut-buffer) # @@ -287,11 +287,13 @@ my $movements "\x15" => { func => \&cmd_movement_ctrl_u }, # half screen up "\x06" => { func => \&cmd_movement_ctrl_f }, # screen down "\x02" => { func => \&cmd_movement_ctrl_b }, # screen up + # window switching + "\x17" => { func => \&cmd_movement_ctrl_w }, + "\x1e" => { func => \&cmd_movement_ctrl_6 }, # misc '~' => { func => \&cmd_movement_tilde }, '.' => {}, '"' => { func => \&cmd_movement_register }, - "\x1e" => { func => \&cmd_movement_ctrl_6 }, # undo 'u' => { func => \&cmd_undo }, "\x12" => { func => \&cmd_redo }, # ctrl-r @@ -306,6 +308,7 @@ my $movements_multiple = 'T' => undef, 'r' => undef, '"' => undef, + "\x17" => undef, # ctrl-w }; @@ -905,6 +908,19 @@ sub cmd_movement_register { print "Changing register to $register" if DEBUG; } +sub cmd_movement_ctrl_w { + my ($count, $pos, $repeat, $char) = @_; + + if ($char eq 'j') { + while ($count -- > 0) { + Irssi::command('window down'); + } + } elsif ($char eq 'k') { + while ($count -- > 0) { + Irssi::command('window up'); + } + } +} sub cmd_movement_ctrl_6 { # like :b# Irssi::command('window last'); -- cgit v1.2.3