diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-10-01 16:12:33 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-10-01 16:43:27 +0000 |
commit | cb830faff50530169eef1c932de56233b2f3c9c1 (patch) | |
tree | f891312de75c45fd36a3625e808b48ea715a2467 /vim-mode/vim_mode.pl | |
parent | vim_mode: Allow movement functions to change $cur_pos. (diff) | |
download | irssi-scripts-cb830faff50530169eef1c932de56233b2f3c9c1.tar.gz irssi-scripts-cb830faff50530169eef1c932de56233b2f3c9c1.zip |
vim_mode: First work on text-objects.
They do nothing at the moment, but get (correctly) called.
Diffstat (limited to '')
-rw-r--r-- | vim-mode/vim_mode.pl | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 4c91329..e861c71 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -297,6 +297,9 @@ my $movements 'W' => { func => \&cmd_movement_W }, 'B' => { func => \&cmd_movement_B }, 'E' => { func => \&cmd_movement_E }, + # text-objects + 'i_' => { func => \&cmd_movement_i_ }, + 'a_' => { func => \&cmd_movement_a_ }, # line movement '0' => { func => \&cmd_movement_0 }, '^' => { func => \&cmd_movement_caret }, @@ -768,6 +771,19 @@ sub _end_of_WORD { return $pos; } +sub cmd_movement_i_ { + my ($count, $pos, $repeat, $char) = @_; + + _warn("i_ not implemented yet"); + return; +} +sub cmd_movement_a_ { + my ($count, $pos, $repeat, $char) = @_; + + _warn("a_ not implemented yet"); + return; +} + sub cmd_movement_0 { _input_pos(0); return; @@ -1438,7 +1454,9 @@ sub handle_command_cmd { print "Processing numeric prefix: $char" if DEBUG; handle_numeric_prefix($char); - } elsif (!$movement && exists $movements_multiple->{$char}) { + # text-objects (i a) are simulated with $movement + } elsif (!$movement && (exists $movements_multiple->{$char} + or $operator and ($char eq 'i' or $char eq 'a'))) { print "Processing movement: $char" if DEBUG; $movement = $char; @@ -1527,6 +1545,10 @@ sub handle_command_cmd { # Use the real movement command (like t or f) for operator # below. $char = substr $movement, 0, 1; + # i_ and a_ represent text-objects. + if ($char eq 'i' or $char eq 'a') { + $char .= '_'; + } $return = $movements->{$char}->{func} ->($numeric_prefix, $cur_pos, $repeat, substr $movement, 1); |