Make ^l clear screen and scrollback

This commit is contained in:
Alexander Rosenberg 2022-12-02 16:34:57 -08:00
parent dfcd3eb18b
commit 338b3e67c5
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

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