From fd75583e7c9067df730f50f1a70981fc4707f8c2 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 2 Oct 2010 18:06:44 +0200 Subject: vim_mode: Move some functions. No changes. --- vim-mode/vim_mode.pl | 137 +++++++++++++++++++++++++-------------------------- 1 file changed, 68 insertions(+), 69 deletions(-) (limited to 'vim-mode') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index f406592..cd47878 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -372,33 +372,6 @@ my $movements_repeatable }; -sub cmd_undo { - print "Undo!" if DEBUG; - - _restore_undo_entry($undo_index); - print "Undoing entry index: $undo_index of " . scalar(@undo_buffer) if DEBUG; - if ($undo_index != $#undo_buffer) { - $undo_index++; - } else { - print "No further undo." if DEBUG; - } - return (undef, undef); -} - -sub cmd_redo { - print "Redo!" if DEBUG; - print "Undoing entry index: $undo_index of " . scalar(@undo_buffer) if DEBUG; - - _restore_undo_entry($undo_index); - - if ($undo_index != 0) { - $undo_index--; - } else { - print "No further Redo." if DEBUG; - } - return (undef, undef); -} - sub cmd_operator_c { my ($old_pos, $new_pos, $move, $repeat) = @_; @@ -626,6 +599,34 @@ sub _next_occurrence { return $pos; } +sub cmd_movement_semicolon { + my ($count, $pos, $repeat) = @_; + + return (undef, undef) if not defined $last_ftFT; + + (undef, $pos) + = $movements->{$last_ftFT->{type}} + ->{func}($count, $pos, $repeat, $last_ftFT->{char}); + return (undef, $pos); +} +sub cmd_movement_comma { + my ($count, $pos, $repeat) = @_; + + return (undef, undef) if not defined $last_ftFT; + + # Change direction. + my $save = $last_ftFT->{type}; + my $type = $save; + $type =~ tr/ftFT/FTft/; + + (undef, $pos) + = $movements->{$type} + ->{func}($count, $pos, $repeat, $last_ftFT->{char}); + # Restore type as the move functions overwrites it. + $last_ftFT->{type} = $save; + return (undef, $pos); +} + sub cmd_movement_w { my ($count, $pos, $repeat) = @_; @@ -1047,6 +1048,26 @@ sub cmd_movement_ctrl_b { return (undef, undef); } +sub cmd_movement_ctrl_w { + my ($count, $pos, $repeat, $char) = @_; + + if ($char eq 'j') { + while ($count -- > 0) { + Irssi::command('window down'); + } + } elsif ($char eq 'k') { + while ($count -- > 0) { + Irssi::command('window up'); + } + } + return (undef, undef); +} +sub cmd_movement_ctrl_6 { + # like :b# + Irssi::command('window last'); + return (undef, undef); +} + sub cmd_movement_tilde { my ($count, $pos, $repeat) = @_; @@ -1059,35 +1080,6 @@ sub cmd_movement_tilde { return (undef, _fix_input_pos($pos + $count, length $input)); } -sub cmd_movement_semicolon { - my ($count, $pos, $repeat) = @_; - - return (undef, undef) if not defined $last_ftFT; - - (undef, $pos) - = $movements->{$last_ftFT->{type}} - ->{func}($count, $pos, $repeat, $last_ftFT->{char}); - return (undef, $pos); -} -sub cmd_movement_comma { - my ($count, $pos, $repeat) = @_; - - return (undef, undef) if not defined $last_ftFT; - - # Change direction. - my $save = $last_ftFT->{type}; - my $type = $save; - $type =~ tr/ftFT/FTft/; - - (undef, $pos) - = $movements->{$type} - ->{func}($count, $pos, $repeat, $last_ftFT->{char}); - # Restore type as the move functions overwrites it. - $last_ftFT->{type} = $save; - return (undef, $pos); -} - - sub cmd_movement_register { my ($count, $pos, $repeat, $char) = @_; @@ -1138,23 +1130,29 @@ sub cmd_movement_g { return (undef, $pos); } -sub cmd_movement_ctrl_w { - my ($count, $pos, $repeat, $char) = @_; +sub cmd_undo { + print "Undo!" if DEBUG; - if ($char eq 'j') { - while ($count -- > 0) { - Irssi::command('window down'); - } - } elsif ($char eq 'k') { - while ($count -- > 0) { - Irssi::command('window up'); - } + _restore_undo_entry($undo_index); + print "Undoing entry index: $undo_index of " . scalar(@undo_buffer) if DEBUG; + if ($undo_index != $#undo_buffer) { + $undo_index++; + } else { + print "No further undo." if DEBUG; } return (undef, undef); } -sub cmd_movement_ctrl_6 { - # like :b# - Irssi::command('window last'); +sub cmd_redo { + print "Redo!" if DEBUG; + print "Undoing entry index: $undo_index of " . scalar(@undo_buffer) if DEBUG; + + _restore_undo_entry($undo_index); + + if ($undo_index != 0) { + $undo_index--; + } else { + print "No further Redo." if DEBUG; + } return (undef, undef); } @@ -1174,6 +1172,7 @@ sub _fix_input_pos { return $pos; } + sub cmd_ex_command { my $arg_str = join '', @ex_buf; if ($arg_str =~ m|^s/(.+)/(.*)/([ig]*)|) { -- cgit v1.2.3