Hi Chris,
What you want is a bit harder in fish than in bash. In bash, the prompt is
specified by some kind of format string that can be manipulated. In fish,
it's a function, and functions are not really first class values in the way
they are in scripting languages like python. What you'd want to do is rename
the old fish_prompt function to something else, and make a new fish_prompt
function that calls the old one. Unfortunately, as far as I know there's no
direct way to rename a function. You can do it using this slightly hacky
way, though:
echo "function old_fish_prompt" > tmpfile
echo -n \# >> tmpfile # this will comment out the
# old 'function fish_prompt ... ' line
functions fish_prompt >> tmpfile # dump function definition
. tmpfile # source the 'renamed' function
rm tmpfile
Then you can redefine fish_prompt to do something and then call
old_fish_prompt.
Though if someone knows if it's possible to rename/shadow functions
directly, that would be better. I guess it requires a new builtin, though.
Jan
On Sat, Aug 28, 2010 at 03:37, Christopher Nilsson <
christop...@otherchirps.net> wrote:
> Hi all,
>
> I think I'm missing something obvious.
>
> I'm trying to add a fish_prompt function that adds to the existing prompt.
> I can clobber the old one easily enough, but am having trouble building on
> it.
>
> The aim is to convert a bash script, which is simply setting PS1="(new
> prompt stuff) $PS1". Is there a fishy equivalent?
>
> Thanks,
> Chris.
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
>
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users