From a18dc0ebc72e2aba67506cdb5b57db3f7f5d50c0 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 28 Sep 2010 03:27:13 +0200 Subject: vim_mode: Add support for :b s/c Where s is the server (lowercase) and c is the channel (lowercase). --- vim-mode/vim_mode.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index f61ce95..e5cf904 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -726,6 +726,15 @@ sub cmd_ex_command { Irssi::command('window last'); # Go to best regex matching window. } else { + my $server; + + if ($buffer =~ m{^(.+)/(.+)}) { + $server = $1; + $buffer = $2; + } + + print ":b searching for channel $buffer" if DEBUG; + print ":b on server $server" if $server and DEBUG; my @matches; foreach my $window (Irssi::windows()) { @@ -739,6 +748,11 @@ sub cmd_ex_command { } # Matching Window item names (= channels). foreach my $item ($window->items()) { + # Wrong server. + if ($server and (!$item->{server} or + $item->{server}->{chatnet} !~ /^$server/i)) { + next; + } if ($item->{name} =~ /$buffer/i) { my $length = length($item->{name}); $length-- if index($item->{name}, '#') == 0; -- cgit v1.2.3