I want to print a new line after a command if it had any output (I hope that this will make it more readable once my terminal starts scrolling).
I found this:
precmd() {
precmd() {
print ""
}
}
Which works, but obviously prints line after every command.
And also this:
precmd () {
exec 2>&- >&-
lastline=$(tail -1 ~/.command.out)
sleep 0.1
exec > /dev/tty 2>&1
}
preexec() {
exec > >(tee ~/.command.out&)
}
And tried to modify it, but it "breaks" the output (and makes vim un-usable) even w/o my modificatons.
$PS1?zsh/terminfomodule can help with that) and read the terminal's response (readbuiltin, note that this will clash with typeahead from the user, I don't think there's a way to avoid that). The place to do this is inprecmd.