From aee98a7b35bba8c93c027ed9042ff24f117e1b2e Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 10 Oct 2010 03:57:52 +0200 Subject: vim_mode: Add in command mode. is also mappable now. --- vim-mode/vim_mode.pl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index f2bd978..77a4908 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -87,9 +87,9 @@ # # {lhs} is the key combination to be mapped, {rhs} the target. The <> notation # is used (e.g. is Ctrl-F), case is ignored. Supported <> keys: -# -, , , , , . Mapping ex-mode and irssi -# commands is supported. When mapping ex-mode commands the trailing is -# not necessary. Only default mappings can be used in {rhs}. +# -, , , , , , . Mapping ex-mode and +# irssi commands is supported. When mapping ex-mode commands the trailing +# is not necessary. Only default mappings can be used in {rhs}. # Examples: # :map w W - to remap w to work like W # :map gb :bnext - to map gb to call :bnext @@ -278,9 +278,10 @@ my $commands repeatable => 1 }, # arrow like movement - h => { char => 'h', func => \&cmd_h, type => C_NORMAL }, - l => { char => 'l', func => \&cmd_l, type => C_NORMAL }, - ' ' => { char => '', func => \&cmd_l, type => C_NORMAL }, + h => { char => 'h', func => \&cmd_h, type => C_NORMAL }, + l => { char => 'l', func => \&cmd_l, type => C_NORMAL }, + "\x7F" => { char => '', func => \&cmd_h, type => C_NORMAL }, + ' ' => { char => '', func => \&cmd_l, type => C_NORMAL }, # history movement j => { char => 'j', func => \&cmd_j, type => C_NORMAL, no_operator => 1 }, @@ -1799,6 +1800,9 @@ sub _parse_mapping_bracket { # } elsif ($string eq 'cr') { $string = "\n"; + # + } elsif ($string eq 'bs') { + $string = chr(127); # Invalid char, return special string to recognize the error. } else { $string = ''; @@ -1811,6 +1815,7 @@ sub _parse_mapping_reverse { # Convert char to . $string =~ s/ //g; $string =~ s/\n//g; + $string =~ s/\x7F//g; # Convert Ctrl-X to . $string =~ s/([\x01-\x1A])/""/ge; # Convert Ctrl-6 and Ctrl-^ to . -- cgit v1.2.3