So, I started using zsh and oh-my-zsh recently. I am using the pure (refined) theme and the prompt shows extra info above the prompt.

When I clear the Terminal with Ctrl + L, the whole Terminal gets cleared but the line before the prompt that shows the current directory and git information also get cleared. When I type clear however, the line stays with the prompt while the Terminal gets cleared.

Is there a way to keep that line when I press Ctrl + L? What does that shortcut point to and how can I change it? In my Terminal preferences (I'm on Manjaro Budgie), that key binding is absent in the shortcuts list.

  • 1
    This doesn't happen when I use the pure theme; both clear and ^L draw the full 2-line prompt. You can see what ^L is bound to with bindkey | fgrep '^L'. It defaults to clear-screen, which you can read about in man zshzle. But I suspect there's something else at fault; it should work without any hacks. I'd test a different terminal emulator (xterm, sakura, Konsole). Then I'd create a clean .zshrc with only source /path/to/pure.zsh and see if that works. Then gradually add more of your other config back in until you find the piece that is breaking it.
    – Tim Smith
    Jun 29, 2018 at 18:59
  • Tilix also behaves the same way. I'll try modifying my .zshrc file.
    – swa_mi
    Jun 30, 2018 at 5:12

1 Answer 1


Most likely those extra lines are output by precmd, the hook that is run after each command and before the prompt. It is not called automatically upon clear-screen (bound on ^L).

You could redefine clear-screen so it calls it though:

clear-screen() { echoti clear; precmd; zle redisplay; }
zle -N clear-screen

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.