-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cmd + k to refresh prompt #45
Comments
Just wanted to add some more context which I forgot to include. I use tmux, and this refresh issue is only relevant in the context of switching panes / windows in tmux. |
Would something like this do the trick? Not sure exactly what kind of clearing you're after, you may want to use # -- Refresh prompt, rerunning any hooks --
# Credit: Roman Perepelitsa
# Original: https://github.com/romkatv/zsh4humans/blob/v2/fn/-z4h-redraw-prompt
.zle_redraw-prompt () {
for 1 ( chpwd $chpwd_functions precmd $precmd_functions ) {
if (( $+functions[$1] )) $1 &>/dev/null
}
zle .reset-prompt
zle -R
}
zle -N .zle_redraw-prompt
# -- Better Screen Clearing --
# Clear line and redraw prompt, restore line at next prompt
# Key: ctrl+l
# Optional: .zle_redraw-prompt
.zle_push-line-and-clear () {
zle .push-input
zle .clear-screen
if (( $+functions[.zle_redraw-prompt] )) zle .zle_redraw-prompt
}
zle -N .zle_push-line-and-clear
bindkey '^L' .zle_push-line-and-clear # ctrl+l |
First off, thanks for the awesome prompt! I was previously using my own but the git checks were slowing it down so I replaced it with yours which is very nice.
One thing I've noticed is that I used to be able to press Cmd + k (to clear my terminal buffer) and it would refresh the state of the prompt.
But with yours I need to press Enter
Is there way to configure it to refresh on Cmd + k ?
The text was updated successfully, but these errors were encountered: