mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-25 11:43:40 +08:00
38b24c2325
This makes it so we link to the very top of the document instead of a special anchor we manually include. So clicking e.g. :doc:`string <cmds/string>` will link you to cmds/string.html instead of cmds/string.html#cmd-string. I would love to have a way to say "this document from the root of the document path", but that doesn't appear to work, I tried `/cmds/string`. So we'll just have to use cmds/string in normal documents and plain `string` from other commands.
25 lines
1.2 KiB
ReStructuredText
25 lines
1.2 KiB
ReStructuredText
.. _cmd-funcsave:
|
|
|
|
funcsave - save the definition of a function to the user's autoload directory
|
|
=============================================================================
|
|
|
|
Synopsis
|
|
--------
|
|
|
|
.. synopsis::
|
|
|
|
funcsave FUNCTION_NAME
|
|
funcsave [-q | --quiet] [(-d | --directory) DIR] FUNCTION_NAME
|
|
|
|
|
|
Description
|
|
-----------
|
|
|
|
``funcsave`` saves a function to a file in the fish configuration directory. This function will be :ref:`automatically loaded <syntax-function-autoloading>` by current and future fish sessions. This can be useful to commit functions created interactively for permanent use.
|
|
|
|
If you have erased a function using :doc:`functions <functions>`'s ``--erase`` option, ``funcsave`` will remove the saved function definition.
|
|
|
|
Because fish loads functions on-demand, saved functions cannot serve as :ref:`event handlers <event>` until they are run or otherwise sourced. To activate an event handler for every new shell, add the function to the :ref:`configuration file <configuration>` instead of using ``funcsave``.
|
|
|
|
This is often used after :doc:`funced <funced>`, which opens the function in ``$EDITOR`` or ``$VISUAL`` and loads it into the current session afterwards.
|