|
|
@ -6,11 +6,25 @@ Loads prompt [themes][1]. |
|
|
|
Settings |
|
|
|
Settings |
|
|
|
-------- |
|
|
|
-------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Prompt Theme |
|
|
|
|
|
|
|
|
|
|
|
To select a prompt theme, add the following to *zpreztorc*, and replace **name** |
|
|
|
To select a prompt theme, add the following to *zpreztorc*, and replace **name** |
|
|
|
with the name of the theme you wish to load. Setting it to **random** will load |
|
|
|
with the name of the theme you wish to load. Setting it to **random** will load |
|
|
|
a random theme. |
|
|
|
a random theme. |
|
|
|
|
|
|
|
|
|
|
|
zstyle ':prezto:module:prompt' theme 'name' |
|
|
|
```sh |
|
|
|
|
|
|
|
zstyle ':prezto:module:prompt' theme 'name' |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Prompt Display Length |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To change working directory prompt display length from 'short', set the |
|
|
|
|
|
|
|
following to 'long' (without '~' expansion) or 'full' (with '~' expansion) |
|
|
|
|
|
|
|
in *zpreztorc*. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```sh |
|
|
|
|
|
|
|
zstyle ':prezto:module:prompt' pwd-length 'short' |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Theming |
|
|
|
Theming |
|
|
|
------- |
|
|
|
------- |
|
|
@ -26,7 +40,7 @@ There are three theme functions, a setup function, a help function, and |
|
|
|
a preview function. The setup function **must** always be defined. The help |
|
|
|
a preview function. The setup function **must** always be defined. The help |
|
|
|
function and the preview functions are optional. |
|
|
|
function and the preview functions are optional. |
|
|
|
|
|
|
|
|
|
|
|
#### prompt_name_setup |
|
|
|
#### `prompt_name_setup` |
|
|
|
|
|
|
|
|
|
|
|
This function is called by the `prompt` function to install the theme. This |
|
|
|
This function is called by the `prompt` function to install the theme. This |
|
|
|
function may define other functions as necessary to maintain the prompt, |
|
|
|
function may define other functions as necessary to maintain the prompt, |
|
|
@ -36,51 +50,57 @@ including a function that displays help or a function used to preview it. |
|
|
|
|
|
|
|
|
|
|
|
The most basic example of this function can be seen below. |
|
|
|
The most basic example of this function can be seen below. |
|
|
|
|
|
|
|
|
|
|
|
function prompt_name_setup { |
|
|
|
```sh |
|
|
|
PROMPT='%m%# ' |
|
|
|
function prompt_name_setup { |
|
|
|
RPROMPT='' |
|
|
|
PROMPT='%m%# ' |
|
|
|
} |
|
|
|
RPROMPT='' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
#### prompt_name_help |
|
|
|
#### `prompt_name_help` |
|
|
|
|
|
|
|
|
|
|
|
If the `prompt_name_setup` function is customizable via parameters, a help |
|
|
|
If the `prompt_name_setup` function is customizable via parameters, a help |
|
|
|
function **should** be defined. The user will access it via `prompt -h name`. |
|
|
|
function **should** be defined. The user will access it via `prompt -h name`. |
|
|
|
|
|
|
|
|
|
|
|
The most basic example of this function can be seen below. |
|
|
|
The most basic example of this function can be seen below. |
|
|
|
|
|
|
|
|
|
|
|
function prompt_name_help { |
|
|
|
```sh |
|
|
|
cat <<EOH |
|
|
|
function prompt_name_help { |
|
|
|
This prompt is color-scheme-able. You can invoke it thus: |
|
|
|
cat <<EOH |
|
|
|
|
|
|
|
This prompt is color-scheme-able. You can invoke it thus: |
|
|
|
|
|
|
|
|
|
|
|
prompt theme [<color1>] [<color2>] |
|
|
|
prompt theme [<color1>] [<color2>] |
|
|
|
|
|
|
|
|
|
|
|
where the color is for the left-hand prompt. |
|
|
|
where the color is for the left-hand prompt. |
|
|
|
EOH |
|
|
|
EOH |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
#### prompt_name_preview |
|
|
|
#### `prompt_name_preview` |
|
|
|
|
|
|
|
|
|
|
|
If the `prompt_name_setup` function is customizable via parameters, a preview |
|
|
|
If the `prompt_name_setup` function is customizable via parameters, a preview |
|
|
|
function **should** be defined. The user will access it via `prompt -p name`. |
|
|
|
function **should** be defined. The user will access it via `prompt -p name`. |
|
|
|
|
|
|
|
|
|
|
|
The most basic example of this function can be seen below. |
|
|
|
The most basic example of this function can be seen below. |
|
|
|
|
|
|
|
|
|
|
|
function prompt_name_preview { |
|
|
|
```sh |
|
|
|
if (( $# > 0 )); then |
|
|
|
function prompt_name_preview { |
|
|
|
prompt_preview_theme theme "$@" |
|
|
|
if (( $# > 0 )); then |
|
|
|
else |
|
|
|
prompt_preview_theme theme "$@" |
|
|
|
prompt_preview_theme theme red green blue |
|
|
|
else |
|
|
|
print |
|
|
|
prompt_preview_theme theme red green blue |
|
|
|
prompt_preview_theme theme yellow magenta black |
|
|
|
print |
|
|
|
fi |
|
|
|
prompt_preview_theme theme yellow magenta black |
|
|
|
} |
|
|
|
fi |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
### Hook Functions |
|
|
|
### Hook Functions |
|
|
|
|
|
|
|
|
|
|
|
There are many Zsh [hook][2] functions, but mostly the *precmd* hook will be |
|
|
|
There are many Zsh [hook][2] functions, but mostly the *precmd* hook will be |
|
|
|
used. |
|
|
|
used. |
|
|
|
|
|
|
|
|
|
|
|
#### prompt_name_precmd |
|
|
|
#### `prompt_name_precmd` |
|
|
|
|
|
|
|
|
|
|
|
This hook is called before the prompt is displayed and is useful for getting |
|
|
|
This hook is called before the prompt is displayed and is useful for getting |
|
|
|
information to display in a prompt. |
|
|
|
information to display in a prompt. |
|
|
@ -93,11 +113,13 @@ a function before you calling it. |
|
|
|
|
|
|
|
|
|
|
|
The most basic example of this function can be seen below. |
|
|
|
The most basic example of this function can be seen below. |
|
|
|
|
|
|
|
|
|
|
|
function prompt_name_precmd { |
|
|
|
```sh |
|
|
|
if (( $+functions[git-info] )); then |
|
|
|
function prompt_name_precmd { |
|
|
|
git-info |
|
|
|
if (( $+functions[git-info] )); then |
|
|
|
fi |
|
|
|
git-info |
|
|
|
} |
|
|
|
fi |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Authors |
|
|
|
Authors |
|
|
|
------- |
|
|
|
------- |
|
|
|