From ba0bdce0469e584a814e601c9f91a430486ea851 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 3 Oct 2010 00:33:25 +0200 Subject: vim_mode: Fix indentation. No code change. --- vim-mode/vim_mode.pl | 136 +++++++++++++++++++++++++-------------------------- 1 file changed, 68 insertions(+), 68 deletions(-) (limited to 'vim-mode/vim_mode.pl') diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index a6244c1..9d78677 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -817,88 +817,88 @@ sub cmd_movement_a_ { # aw and aW if ($char eq 'w' or $char eq 'W') { - while ($count-- > 0 and length($input) > $pos) { - if (substr($input, $pos, 1) =~ /\s/) { - # Any whitespace before the word/WORD must be removed. - if (not defined $cur_pos) { - $cur_pos = _find_regex_before($input, '\S', $pos, 0); - if ($cur_pos < 0) { - $cur_pos = 0; - } else { - $cur_pos++; - } + while ($count-- > 0 and length($input) > $pos) { + if (substr($input, $pos, 1) =~ /\s/) { + # Any whitespace before the word/WORD must be removed. + if (not defined $cur_pos) { + $cur_pos = _find_regex_before($input, '\S', $pos, 0); + if ($cur_pos < 0) { + $cur_pos = 0; + } else { + $cur_pos++; } - # Move before the word/WORD. - if (substr($input, $pos + 1) =~ /^\s+/) { + } + # Move before the word/WORD. + if (substr($input, $pos + 1) =~ /^\s+/) { + $pos += $+[0]; + } + # And delete the word. + if ($char eq 'w') { + if (substr($input, $pos) =~ /^\s($word+|$non_word+)/) { $pos += $+[0]; - } - # And delete the word. - if ($char eq 'w') { - if (substr($input, $pos) =~ /^\s($word+|$non_word+)/) { - $pos += $+[0]; - } else { - $pos = length($input); - } - # WORD } else { - if (substr($input, $pos + 1) =~ /\s/) { - $pos += $-[0] + 1; - } else { - $pos = length($input); - } - } - - # word - } elsif ($char eq 'w') { - # Start at the beginning of this WORD. - if (not defined $cur_pos and $pos > 0 and substr($input, $pos - 1, 2) !~ /(\s.|$word$non_word|$non_word$word)/) { - - $cur_pos = _find_regex_before($input, "^($word+$non_word|$non_word+$word|$word+\\s|$non_word+\\s)", $pos, 1); - if ($cur_pos < 0) { - $cur_pos = 0; - } else { - $cur_pos += 2; - } + $pos = length($input); } - # Delete to the end of the word. - if (substr($input, $pos) =~ /^($word+$non_word|$non_word+$word|$word+\s+\S|$non_word+\s+\S)/) { - $pos += $+[0] - 1; + # WORD + } else { + if (substr($input, $pos + 1) =~ /\s/) { + $pos += $-[0] + 1; } else { $pos = length($input); - # If we are at the end of the line, whitespace before - # the word is also deleted. - my $new_pos = _find_regex_before($input, "^($word+\\s+|$non_word+\\s+)", $pos, 1); - if ($new_pos != -1 and (not defined $cur_pos or $cur_pos > $new_pos + 1)) { - $cur_pos = $new_pos + 1; - } } + } - # WORD + # word + } elsif ($char eq 'w') { + # Start at the beginning of this WORD. + if (not defined $cur_pos and $pos > 0 and substr($input, $pos - 1, 2) !~ /(\s.|$word$non_word|$non_word$word)/) { + + $cur_pos = _find_regex_before($input, "^($word+$non_word|$non_word+$word|$word+\\s|$non_word+\\s)", $pos, 1); + if ($cur_pos < 0) { + $cur_pos = 0; + } else { + $cur_pos += 2; + } + } + # Delete to the end of the word. + if (substr($input, $pos) =~ /^($word+$non_word|$non_word+$word|$word+\s+\S|$non_word+\s+\S)/) { + $pos += $+[0] - 1; } else { - # Start at the beginning of this WORD. - if (not defined $cur_pos and $pos > 0 and - substr($input, $pos - 1, 1) !~ /\s/) { - $cur_pos = _find_regex_before($input, '\s', $pos - 1, 0); - if ($cur_pos < 0) { - $cur_pos = 0; - } else { - $cur_pos++; - } + $pos = length($input); + # If we are at the end of the line, whitespace before + # the word is also deleted. + my $new_pos = _find_regex_before($input, "^($word+\\s+|$non_word+\\s+)", $pos, 1); + if ($new_pos != -1 and (not defined $cur_pos or $cur_pos > $new_pos + 1)) { + $cur_pos = $new_pos + 1; } - # Delete to the end of the word. - if (substr($input, $pos + 1) =~ /^\S*\s+\S/) { - $pos += $+[0]; + } + + # WORD + } else { + # Start at the beginning of this WORD. + if (not defined $cur_pos and $pos > 0 and + substr($input, $pos - 1, 1) !~ /\s/) { + $cur_pos = _find_regex_before($input, '\s', $pos - 1, 0); + if ($cur_pos < 0) { + $cur_pos = 0; } else { - $pos = length($input); - # If we are at the end of the line, whitespace before - # the WORD is also deleted. - my $new_pos = _find_regex_before($input, '\s+', $pos, 1); - if (not defined $cur_pos or $cur_pos > $new_pos + 1) { - $cur_pos = $new_pos + 1; - } + $cur_pos++; + } + } + # Delete to the end of the word. + if (substr($input, $pos + 1) =~ /^\S*\s+\S/) { + $pos += $+[0]; + } else { + $pos = length($input); + # If we are at the end of the line, whitespace before + # the WORD is also deleted. + my $new_pos = _find_regex_before($input, '\s+', $pos, 1); + if (not defined $cur_pos or $cur_pos > $new_pos + 1) { + $cur_pos = $new_pos + 1; } } } + } } return ($cur_pos, $pos); -- cgit v1.2.3