On 10/10/07, Fernando Canizo <[EMAIL PROTECTED]> wrote:
> I just did:
>
> echo 'some handy function definition' > ~/.config/fish/config.fish
>
> Was in a hurry and didn't noticed the '>' instead of '>>', result:
> config gone!

Ouch. I'm sorry to hear that.

>
> 2 questions and 1 possible request:
>
> Q1. Is there a way to recover my configuration by perusing the actual
> environment? I have several terms opened and machine wont go off (I
> hope). Already recovered my functions by doing a:
>
> functions -a > fish.functions.all.bak
>
> But I don't know an easy way to recover environment variables without
> going one by one. I listed the __fish_complete functions, but I were
> unable to find the one the completes a '$<TAB>' keystroke. If I could
> find a way to get all environment variable names I could save them all.

There is no way to get the exact definition of the config file, but
you can get a listing of all current variable definitions.

Just use the 'set' command to list currently defined variables. You
can filter the output to only show exported variable using 'set -x'
and so on. You'll have to go over the list manually and remove things
that you sholdn't set yourself, like PATH.

That said, there aren't many situations where the config.fish is the
easiest way to configure fish. The 'right' way to define functions is
a two-step process:

* First, try out the function be defining it on the commandline, e.g.
'function woot; echo woot!; end'.

* Secondly, use 'funcsave woot' (if your function is named 'woot',
that is)  to save the function into the ~/.config/fish/functions
directory. (funcsave used to be called save_function, I don't remember
exactly when the renaming happened, YMMV)

This has a few benefits:

* You can try out the function until you get it just right.

* You don't accidentally delete your config file.;-)

* All the other running shells will automatically have access to your
new function.

* If you update the definition of an existing function, all running
shells will automatically reload it when needed.

Defining variables in the config file is also something you should
very rarely have to do, since you can use universal variables most of
the time. See 'help variables' for more information on universal
variables and how to use them.

>
> Q2. Is there some way to emulate this from bash:
>
> set -o noclobber
>
> that set disables '>' to overwrite existing files (and you can bypass it
> also, so is pretty useful)
>
> Possible Request: if there's no way to achieve Q2, what about including
> it in the next fish release? I think that set is in the spirit of fish.

Unfortunatly, that is not currently possible. I am not a big fan of
configuration options, so I am a bit hesitant about making the way IO
redirections perform be configurable. I see the value in what you
propose, but if possible I'd rather try to figure out another way to
reach the same goal.

> --
> Fernando Canizo - http://muriandre.homelinux.org/~conan/
>

Axel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to