On 9/11/06, Jason Grossman <[EMAIL PROTECTED]> wrote: > I'd find this new "function -S" feature extremely helpful. At > present I spend a lot of time editing my .fish (and my .bashrc for > that matter), and the new feature would reduce that a lot. It would > also make it easier for me to keep the available functions on several > machines in sync, since it's more straightforward to partially merge > directories than to partially merge .fish files. (I say "partially > merge" for those of us, including me, who need different functions on > different machines e.g. because we run fish on different architectures.) > > No opinion about how it should be implemented, although I think I see > the force of the arguments already made.
You can get pretty much exactly the functionality you want alreay, though you have to do a bit more writing. Specifically, instead of storing function definitions in ~/.fish, use files in the directory ~/.fish.d/functions. (You will have to create this directory yourself) The easy way to do this is to experiment with a function, for example 'do_something' on the commandline until it works. When you'rre happy with how 'do_something' works, just issue this command: functions do_something >~/.fish.d/functions/do_something.fish This will output the current definition of the do_someting function into the file ~/.fish.d/functions/do_something.fish, which all running fish instances will autoload whenever you try to use that function. The new function will be discovered at once by all running shells that use the same home directory, and if you update the function, the new version will automatically be used as well. If you want to do more advanced things, like have computer-specific functions, add the following to your ~/.fish file: set fish_function_path ~/.fish.d/(hostname)/functions $function_path This will make sure that on a computer with the hostname 'severian', fish will always look for a function in ~/.fish.d/severian/function before it tries any of the other standard locations, so you can add severian-specific functions to that directory. You can use the same method but replace '(hostname)' with '(uname -i)' to create functions that are only available for some architectures, etc.. If you are the sysadmin and want to do this for all users on the system, use directories in /etc/fish.d/ instead of ~/.fish.d/, and edit the etc/fish file instead of ~/.fish. Lastly, when assigning a new value to the fish_function_path variable, make sure that the ~/.fish.d/functions directory is first in the path list and /usr/share/fish/functions is last. That way, the sysadmin can override the default fish functions, and the user can override the sysadmin. > > Jason -- Axel ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
