Home > Net >  Getting "ViCommand: no such keymap" errors while using Term::Readline:Zoid
Getting "ViCommand: no such keymap" errors while using Term::Readline:Zoid

Time:02-07

I have a simple bit of code that works well until I export

PERL_RL='Zoid default_mode=ViCommand'

in order to use vi mode while editing. When I test the code I'm getting the error: ViCommand: no such keymap. I installed libterm-readline-zoid-perl and from what I can tell ViCommand is built in so I should be good to go but apparently not.

#!/usr/bin/env perl
use warnings;
use strict;
use Term::ReadLine;

my $term = new Term::ReadLine 'LineEdit';

while ( defined ($_ = $term->readline($ARGV[0],$ARGV[1])) ) {
    print $_;
    exit;
}

CodePudding user response:

Seems like there is no command named ViCommand. However, by inspecting the source, see line 80:

command => { _use => 'Term::ReadLine::Zoid::ViCommand'  },

you should be able to use "ViCommand" line editing by setting the environment variable PERL_RL like this:

PERL_RL='Zoid default_mode=command'

CodePudding user response:

Another solution:

$term->parse_and_bind("set editing-mode vi");
  •  Tags:  
  • Related