Search code examples
macositerm2oh-my-zsh

How can I remove the "empty space" in the terminal at launch?


I use iterm2 with oh-my-zsh (macOS) and I want start "terminal code" on the 1st line (now 5th line). Can you please tell me, How can I do this?

Blank lines between top of terminal and rendering of prompt

This is my ~/.zshrc:

export ZSH=/Users/ivbutsykin/.oh-my-zsh
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true

plugins=(
 zsh-autosuggestions
)

source $ZSH/oh-my-zsh.sh
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"

local user_symbol="$"
if [[ $(print -P "%#") =~ "#" ]]; then
  user_symbol = "#"
fi

POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%{%B%F{black}%K{yellow}%} $user_symbol%{%b%f%k%F{yellow}%} %{%f%}"
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='red'
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"

Solution

  • You can get rid of 3 empty lines by replacing echo -e with echo -ne. To get rid of the remaining empty line you need to upgrade to powerlevel10k.