26.5.5 Function Descriptions (Public API)

vcs_info [user-context]

The main function, that runs all backends and assembles all data into ${vcs_info_msg_*_}. This is the function you want to call from precmd if you want to include up-to-date information in your prompt (see Variable Description below). If an argument is given, that string will be used instead of default in the user-context field of the style context.

vcs_info_hookadd

Statically registers a number of functions to a given hook. The hook needs to be given as the first argument; what follows is a list of hook-function names to register to the hook. The ‘+vi-’ prefix needs to be left out here. See Hooks in vcs_info below for details.

vcs_info_hookdel

Remove hook-functions from a given hook. The hook needs to be given as the first non-option argument; what follows is a list of hook-function names to un-register from the hook. If ‘-a’ is used as the first argument, all occurrences of the functions are unregistered. Otherwise only the last occurrence is removed (if a function was registered to a hook more than once). The ‘+vi-’ prefix needs to be left out here. See Hooks in vcs_info below for details.

vcs_info_lastmsg

Outputs the current values of ${vcs_info_msg_*_}. Takes into account the value of the use-prompt-escapes style in ':vcs_info:formats:command:-all-'. It also only prints max-exports values.

vcs_info_printsys [user-context]

Prints a list of all supported version control systems. Useful to find out possible contexts (and which of them are enabled) or values for the disable style.

vcs_info_setsys

Initializes vcs_info’s internal list of available backends. With this function, you can add support for new VCSs without restarting the shell.

All functions named VCS_INFO_* are for internal use only.