From b51bb6d7bfb522b37656638835fa6f00a13d189b Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 29 Sep 2010 18:09:18 +0200 Subject: vim_mode: Add support to append to registers (A-Z). --- vim-mode/vim_mode.pl | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'vim-mode') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index f801761..3cf1b7e 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -326,9 +326,15 @@ sub cmd_operator_d { # Remove the selected string from the input. my $input = _input(); - $registers->{$register} = substr $input, $pos, $length, ''; + my $string = substr $input, $pos, $length, ''; + if ($register =~ /[A-Z]/) { + $registers->{lc $register} .= $string; + print "Deleted into $register: ", $registers->{lc $register} if DEBUG; + } else { + $registers->{$register} = $string; + print "Deleted into $register: ", $registers->{$register} if DEBUG; + } _input($input); - print "Deleted into $register: " . $registers->{$register} if DEBUG; # Move the cursor at the right position. _input_pos($pos); @@ -340,8 +346,14 @@ sub cmd_operator_y { # Extract the selected string and put it in the " register. my $input = _input(); - $registers->{$register} = substr $input, $pos, $length; - print "Yanked into $register: " . $registers->{$register} if DEBUG; + my $string = substr $input, $pos, $length; + if ($register =~ /[A-Z]/) { + $registers->{lc $register} .= $string; + print "Yanked into $register: ", $registers->{lc $register} if DEBUG; + } else { + $registers->{$register} = $string; + print "Yanked into $register: ", $registers->{$register} if DEBUG; + } _input_pos($old_pos); } @@ -749,7 +761,7 @@ sub cmd_movement_tilde { sub cmd_movement_register { my ($count, $pos, $repeat, $char) = @_; - if (not exists $registers->{$char}) { + if (not exists $registers->{$char} and not exists $registers->{lc $char}) { print "Wrong register $char, ignoring." if DEBUG; return; } -- cgit v1.2.3