diff options
author | Tom Feist <shabble@metavore.org> | 2011-04-22 00:36:54 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2011-04-22 00:36:54 +0000 |
commit | 10f7e62c5f4ac6f2d524d8fdef754efc70b62d7f (patch) | |
tree | 9566c2be0e40609932191af9cd73eb2e3b38361b /vim-mode | |
parent | notifyquit: removed debug prints. (diff) | |
download | irssi-scripts-10f7e62c5f4ac6f2d524d8fdef754efc70b62d7f.tar.gz irssi-scripts-10f7e62c5f4ac6f2d524d8fdef754efc70b62d7f.zip |
vim-mode/vim_mode: added a new $vim_wins expando to be used instead of the
vim_windows statusbar item if desired.
Diffstat (limited to 'vim-mode')
-rw-r--r-- | vim-mode/vim_mode.pl | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 30b2e9e..fb818dd 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2555,22 +2555,7 @@ sub vim_mode_cmd { return $mode_str; } -sub vim_exp_mode { - my ($server, $witem, $arg) = @_; - return vim_mode_cmd(); -} - -# vi mode status item. -sub vim_mode_cb { - my ($sb_item, $get_size_only) = @_; - my $mode_str = vim_mode_cmd(); - $sb_item->default_handler($get_size_only, "{sb $mode_str}", '', 0); -} - -# :b window list item. -sub b_windows_cb { - my ($sb_item, $get_size_only) = @_; - +sub vim_wins_data { my $windows = ''; # A little code duplication of cmd_ex_command(), but \s+ instead of \s* so @@ -2590,6 +2575,31 @@ sub b_windows_cb { } } } + return $windows; +} + +sub vim_exp_mode { + my ($server, $witem, $arg) = @_; + return vim_mode_cmd(); +} + +sub vim_exp_wins { + my ($server, $witem, $arg) = @_; + return vim_wins_data(); +} + +# vi mode status item. +sub vim_mode_cb { + my ($sb_item, $get_size_only) = @_; + my $mode_str = vim_mode_cmd(); + $sb_item->default_handler($get_size_only, "{sb $mode_str}", '', 0); +} + +# :b window list item. +sub b_windows_cb { + my ($sb_item, $get_size_only) = @_; + + my $windows = vim_wins_data(); $sb_item->default_handler($get_size_only, "{sb $windows}", '', 0); } @@ -3125,6 +3135,8 @@ sub vim_mode_init { Irssi::statusbar_item_register ('vim_windows', 0, 'b_windows_cb'); Irssi::expando_create('vim_cmd_mode' => \&vim_exp_mode, {}); + Irssi::expando_create('vim_wins' => \&vim_exp_wins, {}); + # Register all available settings. foreach my $name (keys %$settings) { |