diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-10-10 01:42:29 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-10-10 01:42:29 +0000 |
commit | b97f23c09096d3c40bf15417dad1f6a1e3c447c7 (patch) | |
tree | ae7d854dab338a1b18989b546edc4973d255afdf | |
parent | vim_mode: Add known bug. (diff) | |
download | irssi-scripts-b97f23c09096d3c40bf15417dad1f6a1e3c447c7.tar.gz irssi-scripts-b97f23c09096d3c40bf15417dad1f6a1e3c447c7.zip |
vim_mode: :map {lhs} displays matching mappings.
Diffstat (limited to '')
-rw-r--r-- | vim-mode/vim_mode.pl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index f84c523..f2bd978 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -74,6 +74,7 @@ # * Source files :so[urce] - only sources vim_moderc at the moment, # {file} not supported # * Mappings: :map - display custom mappings +# :map {lhs} - display mappings starting with {lhs} # :map {lhs} {rhs} - add mapping # :unm[ap] {lhs} - remove custom mapping # * Save mappings: :mkv[imrc][!] - like in Vim, but [file] not supported @@ -1733,14 +1734,18 @@ sub ex_map { } add_map($lhs, $command); - # :map - } elsif ($arg_str eq 'map') { + # :map [lhs] + } elsif ($arg_str eq 'map' or $arg_str =~ /^map (\S+)$/) { + # Necessary for case insensitive matchings. lc alone won't work. + my $search = _parse_mapping_reverse(_parse_mapping($1)); + my $active_window = Irssi::active_win(); foreach my $key (sort keys %$maps) { my $map = $maps->{$key}; my $cmd = $map->{cmd}; if (defined $cmd) { next if $map->{char} eq $cmd->{char}; # skip default mappings + next if $map->{char} !~ /^\Q$search\E/; # skip non-matches $active_window->print(sprintf "%-15s %s", $map->{char}, $cmd->{char}); } |