committed by
Sindre Sorhus
parent
2509a1fac0
commit
ba1f064357
17
pure.zsh
17
pure.zsh
@@ -47,6 +47,15 @@ prompt_pure_check_cmd_exec_time() {
|
|||||||
(($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed
|
(($elapsed > ${PURE_CMD_MAX_EXEC_TIME:=5})) && prompt_pure_human_time $elapsed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt_pure_clear_screen() {
|
||||||
|
# enable output to terminal
|
||||||
|
zle -I
|
||||||
|
# clear screen and move cursor to (0, 0)
|
||||||
|
print -n '\e[2J\e[0;0H'
|
||||||
|
# print preprompt
|
||||||
|
prompt_pure_preprompt_render precmd
|
||||||
|
}
|
||||||
|
|
||||||
prompt_pure_check_git_arrows() {
|
prompt_pure_check_git_arrows() {
|
||||||
# check if there is an upstream configured for this branch
|
# check if there is an upstream configured for this branch
|
||||||
command git rev-parse --abbrev-ref @'{u}' &>/dev/null || return
|
command git rev-parse --abbrev-ref @'{u}' &>/dev/null || return
|
||||||
@@ -249,6 +258,7 @@ prompt_pure_setup() {
|
|||||||
prompt_opts=(subst percent)
|
prompt_opts=(subst percent)
|
||||||
|
|
||||||
zmodload zsh/datetime
|
zmodload zsh/datetime
|
||||||
|
zmodload zsh/zle
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
autoload -Uz vcs_info
|
autoload -Uz vcs_info
|
||||||
autoload -Uz async && async
|
autoload -Uz async && async
|
||||||
@@ -261,6 +271,13 @@ prompt_pure_setup() {
|
|||||||
zstyle ':vcs_info:git*' formats ' %b'
|
zstyle ':vcs_info:git*' formats ' %b'
|
||||||
zstyle ':vcs_info:git*' actionformats ' %b|%a'
|
zstyle ':vcs_info:git*' actionformats ' %b|%a'
|
||||||
|
|
||||||
|
# if the user has not registered a custom zle widget for clear-screen,
|
||||||
|
# override the builtin one so that the preprompt is displayed correctly when
|
||||||
|
# ^L is issued.
|
||||||
|
if [[ $widgets[clear-screen] == 'builtin' ]]; then
|
||||||
|
zle -N clear-screen prompt_pure_clear_screen
|
||||||
|
fi
|
||||||
|
|
||||||
# show username@host if logged in through SSH
|
# show username@host if logged in through SSH
|
||||||
[[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username=' %F{242}%n@%m%f'
|
[[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username=' %F{242}%n@%m%f'
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,12 @@ antigen bundle sindresorhus/pure
|
|||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
|
### My preprompt is missing when I clear the screen with Ctrl+L
|
||||||
|
|
||||||
|
Pure doesn't register its custom *clear-screen* widget if it has been previously modified. If you haven't registered your own zle widget with `zle -N clear-screen custom-clear-screen` it might have been done by third-party modules. For example `zsh-syntax-highlighting` and `zsh-history-substring-search` are known to do this and they should for that reason be **the very last thing** in your `.zshrc` (as pointed out in their documentation).
|
||||||
|
|
||||||
|
To find out the culprit that is overriding your *clear-screen* widget, you can run the following command: `zle -l | grep clear-screen`.
|
||||||
|
|
||||||
### I am stuck in a shell loop in my terminal that ask me to authenticate. What should I do ?
|
### I am stuck in a shell loop in my terminal that ask me to authenticate. What should I do ?
|
||||||
|
|
||||||
[This is a known issue](https://github.com/sindresorhus/pure/issues/76).
|
[This is a known issue](https://github.com/sindresorhus/pure/issues/76).
|
||||||
|
|||||||
Reference in New Issue
Block a user