fish-shell/doc_src/cmds/fish_hg_prompt.rst
Fabian Boehm 38b24c2325 docs: Use :doc: role when linking to commands
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.
2022-09-24 10:56:43 +02:00

68 lines
2.1 KiB
ReStructuredText

.. _cmd-fish_hg_prompt:
fish_hg_prompt - output Mercurial information for use in a prompt
=================================================================
Synopsis
--------
.. synopsis::
fish_hg_prompt
::
function fish_prompt
printf '%s' $PWD (fish_hg_prompt) ' $ '
end
Description
-----------
The fish_hg_prompt function displays information about the current Mercurial repository, if any.
`Mercurial <https://www.mercurial-scm.org/>`_ (``hg``) must be installed.
By default, only the current branch is shown because ``hg status`` can be slow on a large repository. You can enable a more informative prompt by setting the variable ``$fish_prompt_hg_show_informative_status``, for example::
set --universal fish_prompt_hg_show_informative_status
If you enabled the informative status, there are numerous customization options, which can be controlled with fish variables.
- ``$fish_color_hg_clean``, ``$fish_color_hg_modified`` and ``$fish_color_hg_dirty`` are colors used when the repository has the respective status.
Some colors for status symbols:
- ``$fish_color_hg_added``
- ``$fish_color_hg_renamed``
- ``$fish_color_hg_copied``
- ``$fish_color_hg_deleted``
- ``$fish_color_hg_untracked``
- ``$fish_color_hg_unmerged``
The status symbols themselves:
- ``$fish_prompt_hg_status_added``, default '✚'
- ``$fish_prompt_hg_status_modified``, default '*'
- ``$fish_prompt_hg_status_copied``, default '⇒'
- ``$fish_prompt_hg_status_deleted``, default '✖'
- ``$fish_prompt_hg_status_untracked``, default '?'
- ``$fish_prompt_hg_status_unmerged``, default '!'
Finally, ``$fish_prompt_hg_status_order``, which can be used to change the order the status symbols appear in. It defaults to ``added modified copied deleted untracked unmerged``.
See also :doc:`fish_vcs_prompt <fish_vcs_prompt>`, which will call all supported version control prompt functions, including git, Mercurial and Subversion.
Example
-------
A simple prompt that displays hg info::
function fish_prompt
...
set -g fish_prompt_hg_show_informative_status
printf '%s %s$' $PWD (fish_hg_prompt)
end