abra zsh config 2.0

This commit is contained in:
Andrey Anurin
2018-08-12 15:26:21 +03:00
parent 201abd09c4
commit 6b114440e2
1195 changed files with 68948 additions and 10539 deletions

View File

@@ -6,11 +6,34 @@ Loads prompt [themes][1].
Settings
--------
### Prompt Theme
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
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'
```
### Display Return Value
Some prompts display the return value in the prompt. If a prompt has support,
this can be disabled with the following snippet.
```sh
zstyle ':prezto:module:prompt' show-return-val 'no'
```
Theming
-------
@@ -26,7 +49,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
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
function may define other functions as necessary to maintain the prompt,
@@ -36,51 +59,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.
function prompt_name_setup {
PROMPT='%m%# '
RPROMPT=''
}
```sh
function prompt_name_setup {
PROMPT='%m%# '
RPROMPT=''
}
```
#### prompt_name_help
#### `prompt_name_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`.
The most basic example of this function can be seen below.
function prompt_name_help {
cat <<EOH
This prompt is color-scheme-able. You can invoke it thus:
```sh
function prompt_name_help {
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.
EOH
}
where the color is for the left-hand prompt.
EOH
}
```
#### prompt_name_preview
#### `prompt_name_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`.
The most basic example of this function can be seen below.
function prompt_name_preview {
if (( $# > 0 )); then
prompt_preview_theme theme "$@"
else
prompt_preview_theme theme red green blue
print
prompt_preview_theme theme yellow magenta black
fi
}
```sh
function prompt_name_preview {
if (( $# > 0 )); then
prompt_preview_theme theme "$@"
else
prompt_preview_theme theme red green blue
print
prompt_preview_theme theme yellow magenta black
fi
}
```
### Hook Functions
There are many Zsh [hook][2] functions, but mostly the *precmd* hook will be
used.
#### prompt_name_precmd
#### `prompt_name_precmd`
This hook is called before the prompt is displayed and is useful for getting
information to display in a prompt.
@@ -93,11 +122,25 @@ a function before you calling it.
The most basic example of this function can be seen below.
function prompt_name_precmd {
if (( $+functions[git-info] )); then
git-info
fi
}
```sh
function prompt_name_precmd {
if (( $+functions[git-info] )); then
git-info
fi
}
```
Troubleshooting
---------------
### Fonts aren't displaying properly.
On most systems, themes which use special characters need to have a patched font
installed and configured properly.
Powerline provides some information on [terminal support][4] and [how to install
patched fonts][5] which should fix most font issues.
Authors
-------
@@ -109,3 +152,5 @@ Authors
[1]: http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Prompt-Themes
[2]: http://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions
[3]: https://github.com/sorin-ionescu/prezto/issues
[4]: http://powerline.readthedocs.io/en/master/usage.html#terminal-emulator-requirements
[5]: http://powerline.readthedocs.io/en/latest/installation.html#fonts-installation