fish-shell/doc_src/cmds/funcsave.rst
Donovan bc2eb383d4
Funcsave with --directory option (#7041)
* funcsave: add option --directory

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix synopsis

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix completion

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix error message

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix parameter expansion

Signed-off-by: Donovan Jean <commit@dkrm.dev>
2020-05-27 20:13:44 +02:00

23 lines
1.0 KiB
ReStructuredText

.. _cmd-funcsave:
funcsave - save the definition of a function to the user's autoload directory
=============================================================================
Synopsis
--------
::
funcsave FUNCTION_NAME
funcsave [(-d | --directory) where/to/save ] FUNCTION_NAME
Description
-----------
``funcsave`` saves a function to a file in the fish configuration directory. This function will be automatically loaded by current and future fish sessions. This can be useful if you have interactively created a new function and wish to save it for later use.
Note that because fish loads functions on-demand, saved functions will not function as :ref:`event handlers <event>` until they are run or sourced otherwise. To activate an event handler for every new shell, add the function to your :ref:`shell initialization file <initialization>` instead of using ``funcsave``.
This is typically used together with :ref:`funced <cmd-funced>`, which will open the function in your editor and load it in the current seession afterwards.