aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-09-26 15:51:31 +0000
committerSimon Ruderich <simon@ruderich.org>2010-09-26 15:52:04 +0000
commitbe9175c54d0345eb53ca0ae4c1e4203b6a9efe7f (patch)
tree10354c4ecbf88fc2b761e6ff568bdc1a35955cce /vim-mode/vim_mode.pl
parentchanged history version-check to emulate an up/down arrow keypress on older (diff)
downloadirssi-scripts-be9175c54d0345eb53ca0ae4c1e4203b6a9efe7f.tar.gz
irssi-scripts-be9175c54d0345eb53ca0ae4c1e4203b6a9efe7f.zip
vim_mode: Add ~.
Diffstat (limited to 'vim-mode/vim_mode.pl')
-rw-r--r--vim-mode/vim_mode.pl15
1 files changed, 15 insertions, 0 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index 621cc4b..e372050 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -11,6 +11,7 @@
# * Insert mode at start: I
# * insert mode at end: A
# * yank and paste: y p P
+# * switch case: ~
# * Combinations like in Vi, e.g. d5fx
# Installation:
@@ -149,6 +150,8 @@ my $movements
# paste
'p' => { func => \&cmd_movement_p },
'P' => { func => \&cmd_movement_P },
+ # misc
+ '~' => { func => \&cmd_movement_tilde },
};
# special movements which take an additional key
@@ -433,6 +436,18 @@ sub _paste_at_position {
_input_pos($pos - 1 + length $string);
}
+sub cmd_movement_tilde {
+ my ($count, $pos) = @_;
+
+ my $input = _input();
+ my $string = substr $input, $pos, $count;
+ $string =~ tr/a-zA-Z/A-Za-z/;
+ substr $input, $pos, $count, $string;
+
+ _input($input);
+ _input_pos($pos + $count);
+}
+
sub cmd_ex_command {
my $arg_str = join '', @ex_buf;
if ($arg_str =~ m|s/(.+)/(.*)/([ig]*)|) {