From c243d1a02838fd12e9fab9bfa243bb075efa1196 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sun, 26 Sep 2010 22:15:31 +0100 Subject: first steps towards undo --- vim-mode/vim_mode.pl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'vim-mode') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index ac067d8..90391da 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -119,6 +119,10 @@ my $history_input = undef; # position in input line my $history_pos = 0; +# Undo/redo buffer. +my @undo_buffer; +my $undo_index = undef; + sub script_is_loaded { my $name = shift; print "Checking if $name is loaded" if DEBUG; @@ -184,6 +188,10 @@ my $movements # misc '~' => { func => \&cmd_movement_tilde }, '.' => {}, + # undo + 'u' => { func => \&cmd_undo }, + "\x12" => { func => \&cmd_redo }, + }; # special movements which take an additional key @@ -195,6 +203,15 @@ my $movements_multiple = 'T' => undef, }; + +sub cmd_undo { + print "Undo!" if DEBUG; +} + +sub cmd_redo { + print "Redo!" if DEBUG; +} + sub cmd_operator_c { my ($old_pos, $new_pos, $move) = @_; -- cgit v1.2.3