From c1144625d59dd269838974b63cec400ca1ac8eb8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 17 Dec 2017 01:00:48 +0100 Subject: Turn the 'on key press' signal into a command Turns out it's possible to make this a command instead of listening for a shortcut on key press. Now when you want to run Vimput, you can make your own binding instead of me forcing C-x: /bind ^X /vimput --- vimput.pl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'vimput.pl') diff --git a/vimput.pl b/vimput.pl index 6bb78fe..b3f6b80 100644 --- a/vimput.pl +++ b/vimput.pl @@ -189,12 +189,7 @@ sub is_ok_message { } -# TODO: Find out if it's possible to do this is a command -Irssi::signal_add_last 'gui key pressed' => sub { - my ($key) = @_; - - if ($key eq CTRL_X) { - write_input(Irssi::parse_special('$L', undef, 0)); - open_tmux_and_update_input_line_when_finished(); - } -}; +Irssi::command_bind('vimput' => sub { + write_input(Irssi::parse_special('$L', undef, 0)); + open_tmux_and_update_input_line_when_finished(); +}); -- cgit v1.2.3