1

I was wondering if there is an easy way to configure ZSH (I am using oh-my-zsh) and/or FISH (just started fiddling with this) to not keep the cursor/promt at the bottom of the terminal as soon an the buffer exceeds the number of displayable lines but rather at the middle of the screen.

The reason for this is that I keep staring at the bottom of my screen when navigating in the console but working mostly in the middle of the terminal when for example doing work in VIM. I would like to try such a behavior to see if that.

2
  • I guess I'm confused about how that might work. Let's say you start from the vertical center'ish of the screen and run a command like ls -la /bin. The results are going to scroll off the screen. Do you want the entire bottom of the terminal to be blank, and the prompt back in the vertical center after that? Or are you saying that you want the prompt to overwrite the results? Apr 10 at 22:22
  • I want (to try) to have the bottom of the terminal blank. Just as an experiment for now. For other applications than the shell (such as VI, a pager, ...) I want to use the whole space. But staring at the bottom of a shell the whole time feels a bit counter intuitive. Maybe that's just me.
    – sontags
    Apr 11 at 5:15

1 Answer 1

2

A quick trial shows this seems to work in ZSH:

PS1=$'\n\n\n\n\n\n\n\n\e[8A'"$PS1"

This has the prompt print 8 newlines, then moves the cursor back up 8 lines with the \e[8A escape code, before printing the actual prompt.

You can add more newlines and increase the scroll-up to match, depending how far off the bottom you want to be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.