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)"