1

When I launch terminal, it always puts a new line at the beginning first. I am using zsh and did install ohmyzsh, but I can't seem to find anything that would cause this behaviour. Please see attached screenshot. Using powerlevel10k theme.

I checked .bashrc, .zshrc, and every other profile I can think of but can't figure it out. enter image description here

New tab and pressed return new tab

UPDATE 2: .zshrc BAD CONTENT IDENTIFIED

# Colorise the top Tabs of Iterm2 with the same color as background
# Just change the 18/26/33 wich are the rgb values
echo -e "\033]6;1;bg;red;brightness;18\a"
echo -e "\033]6;1;bg;green;brightness;26\a"
echo -e "\033]6;1;bg;blue;brightness;33\a"

I don't know why these echo commands are causing that behavior, but when I comment out each one, the "new line" is less and less" until I have commented out all three. I got the commands from this medium.com post but it's only supposed to change the tab color. I have removed them now, but tabs are blah. Better than the line spacing.

9
  • Can you just press Enter/Return in a newly created tab and add a screenshot of the window?
    – nohillside
    Commented May 10, 2021 at 8:14
  • What is the value of $PROMPT
    – mmmmmm
    Commented May 10, 2021 at 8:16
  • @nohillside please see update
    – jabio66
    Commented May 10, 2021 at 14:20
  • 1
    Wow. If you disable the theme, does the problem disappear?
    – nohillside
    Commented May 10, 2021 at 14:29
  • 2
    This is why OhMyZSH is a cancer. Commented May 10, 2021 at 22:03

2 Answers 2

2

echo automatically adds a newline to the end of what it prints; since the escape sequence it's printing doesn't actually display anything on screen, this has the effect of printing a blank line. One option is to add the -n option to echo to tell it not to print the newline, but for complicated reasons some versions of echo will just print "-n" as part of their output (and then go ahead and print the newline too). printf is much more reliable for things like this (though it can be more complex to use correctly). See "Why is printf better than echo?" on the Unix & Linux stackexchange.

In this case, you can just replace echo -e with printf, and it should do the same thing but without the unwanted newlines:

printf "\033]6;1;bg;red;brightness;18\a"
printf "\033]6;1;bg;green;brightness;26\a"
printf "\033]6;1;bg;blue;brightness;33\a"
0

Comment out or remove the following three lines from ~/.zshrc

#echo -e "\033]6;1;bg;red;brightness;18\a"
#echo -e "\033]6;1;bg;green;brightness;26\a"
#echo -e "\033]6;1;bg;blue;brightness;33\a"

Each echo actually creates a new line (on BigSur 11.2.3) and together they create 3 new lines on every new window/tab.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .