From 55745779b3b3ae7b95e15a9835958e5301dc0354 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 1 Oct 2010 01:37:48 +0200 Subject: vim_mode: Add Ctrl-6 in command mode, same like :b#. --- vim-mode/vim_mode.pl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vim-mode') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index f0ad409..a9b7d0f 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -286,6 +286,7 @@ my $movements '~' => { func => \&cmd_movement_tilde }, '.' => {}, '"' => { func => \&cmd_movement_register }, + "\x1e" => { func => \&cmd_movement_ctrl_6 }, # undo 'u' => { func => \&cmd_undo }, "\x12" => { func => \&cmd_redo }, @@ -869,6 +870,11 @@ sub cmd_movement_register { print "Changing register to $register" if DEBUG; } +sub cmd_movement_ctrl_6 { + # like :b# + Irssi::command('window last'); +} + # Adapt the input position depending if an operator is active or not. sub _fix_input_pos { my ($pos, $length) = @_; -- cgit v1.2.3 From c1c1b33cb6210e689926d15fc466fdc129a736d7 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 1 Oct 2010 02:00:04 +0200 Subject: vim_mode: Add :undol[ist], remove Ctrl-D. --- vim-mode/vim_mode.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vim-mode') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index a9b7d0f..8eef556 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -290,8 +290,6 @@ my $movements # undo 'u' => { func => \&cmd_undo }, "\x12" => { func => \&cmd_redo }, - "\x04" => { func => \&_print_undo_buffer }, - }; # special movements which take an additional key @@ -973,6 +971,8 @@ sub cmd_ex_command { # :ls and :buffers } elsif ($arg_str eq 'ls' or $arg_str eq 'buffers') { Irssi::command('window list'); + } elsif ($arg_str eq 'undol' or $arg_str eq 'undolist') { + _print_undo_buffer(); } } -- cgit v1.2.3 From f4515f471290d38acbff699cc59239531c175918 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 1 Oct 2010 02:01:01 +0200 Subject: vim_mode: Add Ctrl-D, Ctrl-U, Ctrl-F, Ctrl-B for scrolling. --- vim-mode/vim_mode.pl | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'vim-mode') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 8eef556..0524be5 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -282,6 +282,11 @@ my $movements # to end of line 'C' => { func => \&cmd_movement_dollar }, 'D' => { func => \&cmd_movement_dollar }, + # scrolling + "\x04" => { func => \&cmd_movement_ctrl_d }, # half screen down + "\x15" => { func => \&cmd_movement_ctrl_u }, # half screen up + "\x06" => { func => \&cmd_movement_ctrl_f }, # screen down + "\x02" => { func => \&cmd_movement_ctrl_b }, # screen up # misc '~' => { func => \&cmd_movement_tilde }, '.' => {}, @@ -808,6 +813,38 @@ sub _paste_at_position { _insert_at_position($registers->{$register}, $count, $pos); } +sub cmd_movement_ctrl_d { + my ($count, $pos, $repeat) = @_; + + my $window = Irssi::active_win(); + # no count = half of screen + if (not defined $count) { + $count = $window->{height} / 2; + } + $window->view()->scroll($count); +} +sub cmd_movement_ctrl_u { + my ($count, $pos, $repeat) = @_; + + my $window = Irssi::active_win(); + # no count = half of screen + if (not defined $count) { + $count = $window->{height} / 2; + } + $window->view()->scroll($count * -1); +} +sub cmd_movement_ctrl_f { + my ($count, $pos, $repeat) = @_; + + my $window = Irssi::active_win(); + $window->view()->scroll($count * $window->{height}); +} +sub cmd_movement_ctrl_b { + my ($count, $pos, $repeat) = @_; + + cmd_movement_ctrl_f($count * -1, $pos, $repeat); +} + sub cmd_movement_tilde { my ($count, $pos, $repeat) = @_; @@ -1312,8 +1349,10 @@ sub handle_command_cmd { if ($skip) { print "Skipping movement and operator." if DEBUG; } else { - # Make sure count is at least 1. - if (not $numeric_prefix) { + # Make sure count is at least 1 except for functions which need to + # know if no count was used + if (not $numeric_prefix and $char ne "\x04" # ctrl-d + and $char ne "\x15") { # ctrl-u $numeric_prefix = 1; } -- cgit v1.2.3