From 94e23c3a5ec43c70b8ff719d7166e001954e5fdc Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 26 Sep 2010 01:05:28 +0200 Subject: vim_mode: Enter in command mode sends current line. Also switches back to insert mode. --- vim-mode/vim_mode.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index e36c41e..e89e4d3 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -504,6 +504,22 @@ sub handle_command { } elsif ($char eq ':') { _update_mode(M_EX); _set_prompt(':'); + + # Enter key sends the current input line in command mode as well. + } elsif ($key == 10) { + my $input = _input(); + my $cmdchars = Irssi::parse_special('$K'); + + my $signal; + if ($input =~ /^[\Q$cmdchars\E]/) { + $signal = 'send command'; + } else { + $signal = 'send text'; + } + Irssi::signal_emit $signal, $input, Irssi::active_server(), + Irssi::active_win()->{active}; + _input(''); + _update_mode(M_INS); } } -- cgit v1.2.3