Skip to content

Commit

Permalink
feat(zsh): make <C-l> retain initial new line of pure prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
kutsan committed Oct 2, 2024
1 parent ccb36c1 commit a6e90a6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .config/zsh/config/prompt.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,18 @@ prompt pure
# Prompt styles.
zstyle :prompt:pure:prompt:error color 1
zstyle :prompt:pure:prompt:success color 15

# This clear screen widget allows Pure to re-render with its initial
# newline by manually clearing the screen and placing the cursor on
# line 4 so that the prompt is redisplayed on lines 2 and 3.
custom_prompt_pure_clear_screen() {
# Enable output to terminal.
zle -I

# Clear screen and move cursor to (4, 0).
print -n '\e[2J\e[4;0H'

# Redraw prompt.
zle .redisplay
}
zle -N clear-screen custom_prompt_pure_clear_screen

0 comments on commit a6e90a6

Please sign in to comment.