NAME

Zoidberg::Fish::Prompt - Modular prompt plugin for Zoidberg

SYNOPSIS

This module is a Zoidberg plugin, see Zoidberg::Fish for details.

DESCRIPTION

This module generates the prompt used by the Buffer plugin. You can put any piece of perl code in its config file to allow any function to output to your prompt.

METHODS

stringify()

Returns a string to use as prompt

getLength()

Returns the length of the previously generated prompt.
This is needed since the string might contain ANSI
escape sequences, the length as returned by this sub
is the length in printable chars

CONFIGURATION

The prompt is defined in profile.pd
A simple prompt definition might look like this: C<prompt => ['> ']>

You can also use bash-like `PS1' escape sequences in the definition, for example: C<prompt => ['\w> ']>
See the file ps1.pd for more details on the definition of escape sequences and bash-compatibility.

The prompt definition is an array-reference, so it can contain multiple parts. These parts will be joined together into a string.
For example: C<prompt => ['\w','>',' ']>

You can supply hash references containing metadata in addition to the raw strings.
For example: 
prompt => [>
  ['\u',{color=>'magenta'}],
  '@',
  ['\h',{color=>'blue'}],
  ['(\L)',{color=>'yellow',if=>'sub{$self->stringify!~/-1/}'}],
  ['#',{color=>'yellow'}],
  ' ',
]
These hashes can contain the following keys:

color: This part of the prompt will be displayed in the given ANSI colour;
maxlen: If the stringified result of this part is longer than $maxlen, the string will scroll from right to left;
if: A piece of perl code that must return true in order for the part to be displayed. In this context, C<$self> means the current piece-of-string object. If the returnvalue is a CODE-reference, the returnvalue of that subref will determine the outcome;

AUTHOR

R.L. Zwart, <rlzwart@cpan.org>

Copyright (c) 2002 Raoul L. Zwart. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Zoidberg

Zoidberg::Fish

http://zoidberg.sourceforge.net.