zsh: Prompt Themes

Next: ZLE Functions, Previous: Version Control Information, Up: User Contributions [Contents][Index]

### 26.6 Prompt Themes

#### 26.6.1 Installation

You should make sure all the functions from the `Functions/Prompts` directory of the source distribution are available; they all begin with the string ‘`prompt_`’ except for the special function‘`promptinit`’. You also need the ‘`colors`’ function from `Functions/Misc`. All of these functions may already have been installed on your system; if not, you will need to find them and copy them. The directory should appear as one of the elements of the `fpath` array (this should already be the case if they were installed), and at least the function `promptinit` should be autoloaded; it will autoload the rest. Finally, to initialize the use of the system you need to call the `promptinit` function. The following code in your `.zshrc` will arrange for this; assume the functions are stored in the directory `~/myfns`:

    fpath=(~/myfns $fpath)
    autoload -U promptinit
    promptinit

#### 26.6.2 Theme Selection

Use the `prompt` command to select your preferred theme. This command may be added to your `.zshrc` following the call to `promptinit` in order to start zsh with a theme already selected.

`prompt` [ `-c` | `-l` ]
`prompt` [ `-p` | `-h` ] [ theme ... ]
`prompt` [ `-s` ] theme [ arg ... ]

  Set or examine the prompt theme. With no options and a theme argument, the theme with that name is set as the current theme. The available themes are determined at run time; use the `-l` option to see a list. The special theme ‘`random`’ selects at random one of the available themes and sets your prompt to that.

  In some cases the theme may be modified by one or more arguments, which should be given after the theme name. See the help for each theme for descriptions of these arguments.

  Options are:

  `-c`

    Show the currently selected theme and its parameters, if any.

  `-l`

    List all available prompt themes.

  `-p`

    Preview the theme named by theme, or all themes if no theme is given.

  `-h`

    Show help for the theme named by theme, or for the `prompt` function if no theme is given.

  `-s`

    Set theme as the current theme and save state.

`prompt_`theme`_setup`

  Each available theme has a setup function which is called by the `prompt` function to install that theme. This function may define other functions as necessary to maintain the prompt, including functions used to preview the prompt or provide help for its use. You should not normally call a theme’s setup function directly.

Next: ZLE Functions, Previous: Version Control Information, Up: User Contributions [Contents][Index]