From 338b3e67c5c014807ab0fa8294241bb918412f3e Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Fri, 2 Dec 2022 16:34:57 -0800 Subject: [PATCH] Make ^l clear screen and scrollback --- init.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/init.zsh b/init.zsh index 99a68f8..ca7bcc2 100644 --- a/init.zsh +++ b/init.zsh @@ -171,6 +171,19 @@ zle -N zle-line-init # Fast switch of modes KEYTIMEOUT=1 +# Clear scrollback on ^l +__zsh_clear_screen_and_scrollback() { + echoti civis >"$TTY" + printf '%b' '\e[H\e[2J' >"$TTY" + zle .reset-prompt + zle -R + printf '%b' '\e[3J' >"$TTY" + echoti cnorm >"$TTY" +} + +zle -N __zsh_clear_screen_and_scrollback +bindkey '^L' __zsh_clear_screen_and_scrollback + # Direnv if which direnv >/dev/null 2>&1; then eval "$(direnv hook zsh)"