diff options
author | Tom Feist <shabble@metavore.org> | 2011-04-18 17:36:38 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2011-04-18 17:36:38 +0000 |
commit | d07463ffc3dce119438403f52b8b21095b1742f4 (patch) | |
tree | 8d8e7d7888463cd0135a64f8e01897269dbac15f | |
parent | uberprompt: minor cleanup of MSGLEVEL args. (diff) | |
download | irssi-scripts-d07463ffc3dce119438403f52b8b21095b1742f4.tar.gz irssi-scripts-d07463ffc3dce119438403f52b8b21095b1742f4.zip |
vim-mode/vim_mode: added '$vim_cmd_mode' expando that contains the same info as
the vim_mode sbar item. Needs some cleanup though
-rw-r--r-- | vim-mode/vim_mode.pl | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 8132ebd..30b2e9e 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -2519,9 +2519,9 @@ sub _matching_windows { # STATUS ITEMS -# vi mode status item. -sub vim_mode_cb { - my ($sb_item, $get_size_only) = @_; +#TODO: give these things better names. +sub vim_mode_cmd { + my $mode_str = ''; if ($mode == M_INS) { $mode_str = 'Insert'; @@ -2530,7 +2530,7 @@ sub vim_mode_cb { } else { $mode_str = '%_Command%_'; if ($register ne '"' or $numeric_prefix or $operator or $movement or - $pending_map) { + $pending_map) { my $partial = ''; if ($register ne '"') { $partial .= '"' . $register; @@ -2552,6 +2552,18 @@ sub vim_mode_cb { $mode_str .= " ($partial)"; } } + 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); } @@ -3112,6 +3124,8 @@ sub vim_mode_init { Irssi::statusbar_item_register ('vim_mode', 0, 'vim_mode_cb'); Irssi::statusbar_item_register ('vim_windows', 0, 'b_windows_cb'); + Irssi::expando_create('vim_cmd_mode' => \&vim_exp_mode, {}); + # Register all available settings. foreach my $name (keys %$settings) { _setting_register($name); @@ -3459,6 +3473,8 @@ sub _update_mode { } Irssi::statusbar_items_redraw("vim_mode"); + Irssi::statusbar_items_redraw ('uberprompt'); + } sub _set_prompt { |