home *** CD-ROM | disk | FTP | other *** search
- # NOTE: Derived from lib/Term/ReadLine/Zoid/ViCommand.pm.
- # Changes made here will be lost when autosplit is run again.
- # See AutoSplit.pm.
- package Term::ReadLine::Zoid::ViCommand;
-
- #line 289 "lib/Term/ReadLine/Zoid/ViCommand.pm (autosplit into blib/lib/auto/Term/ReadLine/Zoid/ViCommand/vi_complete.al)"
- sub vi_complete {
- my ($self, $key) = @_;
-
- return $self->possible_completions() if $key eq '=';
-
- my $buffer = join "\n", @{$$self{lines}};
- my $begin = substr $buffer, 0, $self->pos2off($$self{pos}), '';
- $begin =~ s/(\S*)$//;
- my $glob = $1;
- $$self{pos}[0] -= length $1;
-
- use File::Glob ':glob';
- $glob .= '*' unless $glob =~ /[\*\?\[]/;
- my @list = bsd_glob($glob, GLOB_TILDE | GLOB_BRACE);
-
- my $string;
- if ($key eq '\\') {
- @list = $self->longest_match(@list);
- $string = shift(@list);
- $self->output(@list);
- }
- elsif ($key eq '*') { $string = join ' ', @list }
-
- $$self{pos}[0] += length $string;
- @{$$self{lines}} = split /\n/, $begin . $string . $buffer;
-
- $self->switch_mode() if $key eq '*';
- }
-
- # end of Term::ReadLine::Zoid::ViCommand::vi_complete
- 1;
-