If you just define a new function it's only there in memory, and it's gone
when you exit the shell. You need to call funcsave <functionname> to save it
to ~/.config/fish/functions/ . But I don't know a way to call the
/usr/share/ function if a ~/.config/ function already exists. Sourcing
/usr/share/fish/functions/fish_prompt.fish again overrides the ~/.config/
one for the current session.

Jan


On Sat, Aug 28, 2010 at 18:48, i...@whywouldwe.com <i...@whywouldwe.com>wrote:

>  As far as I recall if you create a new fish prompt function it goes in
> ~/.config/fish/functions/fish_prompt.fish, this will override the default
> one which is somewhere like /usr/share/fish/functions/fish_prompt.fish. I
> think the docs on functions covers this, make the file manually if you need
> to.
>
>
>
> Jan Kanis wrote:
>
> 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 
> listfish-us...@lists.sourceforge.nethttps://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

Reply via email to