aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-10-08 14:20:40 +0000
committerSimon Ruderich <simon@ruderich.org>2010-10-08 14:20:40 +0000
commitc71714608583203fe07b8b5e866a1defba2c3d2a (patch)
treef5e73a6f607a4b6e13342c4e17724df28f4ca381 /vim-mode/vim_mode.pl
parentvim_mode: Add ~/.irssi/vim_moderc as vimrc-like configuration file. (diff)
downloadirssi-scripts-c71714608583203fe07b8b5e866a1defba2c3d2a.tar.gz
irssi-scripts-c71714608583203fe07b8b5e866a1defba2c3d2a.zip
vim_mode: $map->{char} is always in <> notation.
Not control characters.
Diffstat (limited to '')
-rw-r--r--vim-mode/vim_mode.pl23
1 files changed, 12 insertions, 11 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index 4a58273..aacaed5 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -1597,15 +1597,14 @@ sub ex_map {
foreach my $key (sort keys %$maps) {
my $map = $maps->{$key};
my $cmd = $map->{cmd};
- if (defined $map->{char}) {
- my $char = _parse_mapping_reverse($map->{char});
- next if $char eq $cmd->{char}; # skip default mappings
+ if (defined $cmd) {
+ next if $map->{char} eq $cmd->{char}; # skip default mappings
- my $cmdc = _parse_mapping_reverse($cmd->{char});
+ my $cmdc = $cmd->{char};
if ($cmd->{type} == C_EX) {
$cmdc = ":$cmdc";
}
- $active_window->print(sprintf "%-15s %s", $char, $cmdc);
+ $active_window->print(sprintf "%-15s %s", $map->{char}, $cmdc);
}
}
} else {
@@ -2370,7 +2369,10 @@ sub add_map {
while (length $tmp > 1) {
my $map = substr $tmp, -1, 1, '';
if (not exists $maps->{$tmp}) {
- $maps->{$tmp} = { cmd => undef, maps => {} };
+ $maps->{$tmp} = { char => _parse_mapping_reverse($tmp),
+ cmd => undef,
+ maps => {}
+ };
}
if (not exists $maps->{$tmp}->{maps}->{$tmp . $map}) {
$maps->{$tmp}->{maps}->{$tmp . $map} = undef;
@@ -2378,14 +2380,13 @@ sub add_map {
}
if (not exists $maps->{$keys}) {
- $maps->{$keys} = { char => $keys,
- cmd => $command,
+ $maps->{$keys} = { char => undef,
+ cmd => undef,
maps => {}
};
- } else {
- $maps->{$keys}->{char} = $keys;
- $maps->{$keys}->{cmd} = $command;
}
+ $maps->{$keys}->{char} = _parse_mapping_reverse($keys);
+ $maps->{$keys}->{cmd} = $command;
}