From bf37d602a87d2dd43bff8662d766a8553513c798 Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Wed, 29 May 2024 07:39:46 +0300 Subject: [PATCH] {bash,zsh}rc: add a newline before each command To workaround silly files that don't end with a newline --- rc/bashrc | 8 ++++---- rc/zshrc | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/rc/bashrc b/rc/bashrc index b7bd8cca..c7944bca 100755 --- a/rc/bashrc +++ b/rc/bashrc @@ -62,18 +62,18 @@ if [ -n "$force_color_prompt" ]; then fi if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' + PS1='\n${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' + PS1='\n${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt # Red colour for root, thanks nyuszika7h # Check if we're root if [[ $EUID == 0 ]]; then - PS1='\033[1;31m\u@\h:\w\$\033[0m ' + PS1='\n\033[1;31m\u@\h:\w\$\033[0m ' else - PS1='\033[1;32m\u@\h:\w\$\033[0m ' + PS1='\n\033[1;32m\u@\h:\w\$\033[0m ' fi # If this is an xterm set the title to user@host:dir diff --git a/rc/zshrc b/rc/zshrc index a435be01..d1e74ad6 100755 --- a/rc/zshrc +++ b/rc/zshrc @@ -59,6 +59,13 @@ else prompt elite2 green fi +# Newline before new prompt +precmd() { + precmd() { + printf "\n" + } +} + # Use emacs keybindings even if our EDITOR is set to vi bindkey -e