diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-10-08 14:20:40 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-10-08 14:20:40 +0000 |
commit | c71714608583203fe07b8b5e866a1defba2c3d2a (patch) | |
tree | f5e73a6f607a4b6e13342c4e17724df28f4ca381 | |
parent | vim_mode: Add ~/.irssi/vim_moderc as vimrc-like configuration file. (diff) | |
download | irssi-scripts-c71714608583203fe07b8b5e866a1defba2c3d2a.tar.gz irssi-scripts-c71714608583203fe07b8b5e866a1defba2c3d2a.zip |
vim_mode: $map->{char} is always in <> notation.
Not control characters.
-rw-r--r-- | vim-mode/vim_mode.pl | 23 |
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; } |