Basically, when you clear the buffer with Cmd + K, since the status line is printed above the actual prompt, it also gets cleared. This doesn't, however, happen with a simple clear.
I'm hoping someone has a clever way to get around this. So far I've been clearing the buffer then clearing normally immediately after, but it's not ideal.
Spaceship version: 3.10.0
Zsh version: zsh 5.3 (x86_64-apple-darwin17.0)
Zsh framework: oh-my-zsh
Zsh plugin manager: None
Terminal emulator: iTerm
Operating system: macOS

Firstly, your problem has nothing to do with this prompt theme. I don't understand why you opened a issue here.
Clear Buffer with Cmd + K is a terminal function exclusive to iTerm. It's implemented by the terminal to delete the history output.
While clear means clear screen and it just hides the content to the top, which is implemented by the shell.
If you only need a key binding to clear the screen, try Ctrl-L. If it doesn't work, use this
bindkey "^L" clear-screen
It is related to the prompt theme. I'm not saying it's an issue with the theme, but my issue is because of the theme.
With spaceship prompt, the status line is printed above the prompt as a separate line. When you clear the buffer, it clears the status line.
I understand the difference between clearing the buffer and clear. Thank you for your explanation, though.
I was wondering if anybody had a workaround for this, whilst still clearing the buffer. Simply clearing the screen is not enough. That is why I opened this support request.
Thanks for your time.
function clear-scrollback-buffer {
# clear screen
clear
# clear buffer
printf '\e[3J'
# .reset-prompt: bypass the zsh-syntax-highlighting wrapper
# https://github.com/sorin-ionescu/prezto/issues/1026
# https://github.com/zsh-users/zsh-autosuggestions/issues/107#issuecomment-183824034
# -R: redisplay the prompt to avoid old prompts being eaten up
# https://github.com/Powerlevel9k/powerlevel9k/pull/1176#discussion_r299303453
zle .reset-prompt && zle -R
}
zle -N clear-scrollback-buffer
bindkey '^L' clear-scrollback-buffer
That's a great solution, thanks @laggardkernel :)
Most helpful comment