2019-03-31 17:05:09 +08:00
.. _cmd-fish_hg_prompt:
2019-04-11 23:51:00 +08:00
fish_hg_prompt - output Mercurial information for use in a prompt
2019-02-25 08:20:25 +08:00
=================================================================
2019-09-17 17:59:04 +08:00
Synopsis
--------
2021-12-18 07:16:47 +08:00
**fish_hg_prompt**
2019-09-17 17:59:04 +08:00
::
function fish_prompt
2020-10-03 05:36:29 +08:00
printf '%s' $PWD (fish_hg_prompt) ' $ '
2019-09-17 17:59:04 +08:00
end
2019-02-25 08:20:25 +08:00
Description
-----------
2019-04-11 23:51:00 +08:00
The fish_hg_prompt function displays information about the current Mercurial repository, if any.
2019-02-25 08:20:25 +08:00
2019-04-11 23:51:00 +08:00
`Mercurial <https://www.mercurial-scm.org/> `_ (`` hg `` ) must be installed.
2019-02-25 08:20:25 +08:00
2020-12-28 22:11:53 +08:00
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::
2020-03-07 20:01:03 +08:00
2022-01-09 19:26:18 +08:00
set --universal fish_prompt_hg_show_informative_status
2020-03-07 20:01:03 +08:00
If you enabled the informative status, there are numerous customization options, which can be controlled with fish variables.
2019-02-25 08:20:25 +08:00
2019-04-11 23:51:00 +08:00
- `` $fish_color_hg_clean `` , `` $fish_color_hg_modified `` and `` $fish_color_hg_dirty `` are colors used when the repository has the respective status.
2019-02-25 08:20:25 +08:00
Some colors for status symbols:
2019-04-11 23:51:00 +08:00
- `` $fish_color_hg_added ``
- `` $fish_color_hg_renamed ``
- `` $fish_color_hg_copied ``
- `` $fish_color_hg_deleted ``
- `` $fish_color_hg_untracked ``
- `` $fish_color_hg_unmerged ``
2019-02-25 08:20:25 +08:00
2019-04-11 23:51:00 +08:00
The status symbols themselves:
2019-02-25 08:20:25 +08:00
2019-04-11 23:51:00 +08:00
- `` $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 '!'
2019-02-25 08:20:25 +08:00
2019-04-11 23:51:00 +08:00
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 `` .
2019-02-25 08:20:25 +08:00
2019-04-11 23:51:00 +08:00
See also :ref: `fish_vcs_prompt <cmd-fish_vcs_prompt>` , which will call all supported version control prompt functions, including git, Mercurial and Subversion.
2019-02-25 08:20:25 +08:00
Example
-------
A simple prompt that displays hg info::
function fish_prompt
...
2020-03-07 20:01:03 +08:00
set -g fish_prompt_hg_show_informative_status
2019-02-25 08:20:25 +08:00
printf '%s %s$' $PWD (fish_hg_prompt)
end