aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-09-26 16:04:58 +0000
committerSimon Ruderich <simon@ruderich.org>2010-09-26 16:04:58 +0000
commit3eb25f5544e3c385686e5a78690dfa4c1ab17aae (patch)
tree1803150e6eb4aa1a890c3e8e23cdf93441a3771f /vim-mode
parentvim_mode: Add/remove some empty lines. (diff)
downloadirssi-scripts-3eb25f5544e3c385686e5a78690dfa4c1ab17aae.tar.gz
irssi-scripts-3eb25f5544e3c385686e5a78690dfa4c1ab17aae.zip
vim_mode: Add W B E.
At the moment w b e and W B E work the same way (the behavior for W B E is correct). w b e will be changed later to use vi words.
Diffstat (limited to 'vim-mode')
-rw-r--r--vim-mode/vim_mode.pl25
1 files changed, 20 insertions, 5 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index 976c922..a0b5f1c 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -137,6 +137,9 @@ my $movements
'w' => { func => \&cmd_movement_w },
'b' => { func => \&cmd_movement_b },
'e' => { func => \&cmd_movement_e },
+ 'W' => { func => \&cmd_movement_W },
+ 'B' => { func => \&cmd_movement_B },
+ 'E' => { func => \&cmd_movement_E },
# line movement
'0' => { func => \&cmd_movement_0 },
'$' => { func => \&cmd_movement_dollar },
@@ -334,6 +337,18 @@ sub _next_occurrence {
sub cmd_movement_w {
my ($count, $pos) = @_;
+ cmd_movement_W($count, $pos);
+}
+sub cmd_movement_b {
+ my ($count, $pos) = @_;
+ cmd_movement_B($count, $pos);
+}
+sub cmd_movement_e {
+ my ($count, $pos) = @_;
+ cmd_movement_E($count, $pos);
+}
+sub cmd_movement_W {
+ my ($count, $pos) = @_;
my $input = _input();
while ($count-- > 0) {
@@ -345,21 +360,21 @@ sub cmd_movement_w {
}
_input_pos($pos);
}
-sub cmd_movement_b {
+sub cmd_movement_B {
my ($count, $pos) = @_;
my $input = reverse _input();
- $pos = _end_of_word($input, $count, length($input) - $pos - 1);
+ $pos = _end_of_WORD($input, $count, length($input) - $pos - 1);
if ($pos == -1) {
cmd_movement_0();
} else {
_input_pos(length($input) - $pos - 1);
}
}
-sub cmd_movement_e {
+sub cmd_movement_E {
my ($count, $pos) = @_;
- $pos = _end_of_word(_input(), $count, $pos);
+ $pos = _end_of_WORD(_input(), $count, $pos);
if ($pos == -1) {
cmd_movement_dollar();
} else {
@@ -367,7 +382,7 @@ sub cmd_movement_e {
}
}
# Go to the end of $count-th word, like vi's e.
-sub _end_of_word {
+sub _end_of_WORD {
my ($input, $count, $pos) = @_;
# We are already at the end of one a word, ignore the following space so