Current behavior
When loading a new terminal or creating a new tmux window, Spaceship directory prefix does not load until zshrc is sourced.
Expected behavior
Directory prefix loads on new terminal or new tmux window.
.zshrc)SPACESHIP_DIR_TRUNC='1' # show only last directory
SPACESHIP_DIR_SUFFIX=" ] "
SPACESHIP_DIR_PREFIX="┌─[%b "
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true
SPACESHIP_CHAR_SYMBOL="└─▪%b "
SPACESHIP_PROMPT_ORDER=(
time
user
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
package # Package version
aws # Amazon Web Services section
docker
exec_time # Execution time
line_sep # Line break
battery # Battery level and status
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
char # Prompt character
)
Spaceship version: 3.5.0
Zsh version: 5.4.2
Zsh framework: oh-my-zsh
Zsh plugin manager: None
Terminal emulator: iTerm/Gnome-Terminal/Hyper
Operating system: macOS/Windows/Linux

~ ]
└─▪ source ~/.zshrc
┌─[ ~ ]
└─▪
Possible solution
¯_(ツ)_/¯
I pretty sure you did something wrong with an order:
All options must be overridden in your .zshrc file after the theme.
The code from my zshrc that I included above is the last thing in the file. I will play around with changing the order.
With no other settings I get the same result.
.zshrc
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="spaceship" # Set theme
plugins=(
# all disabled for test
)
autoload -U compinit && compinit
source $ZSH/oh-my-zsh.sh # required
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=5'
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true
Opening a new terminal shows:
~ via ⬢ v10.8.0
➜ source ~/.zshrc
in ~ via ⬢ v10.8.0 took 2s
➜
I tried this in a VM as well with Vagrant
I was able to reproduce this. Please move SPACESHIP_PROMPT_FIRST_PREFIX_SHOW before sourcing theme.
export ZSH="$HOME/.oh-my-zsh"
SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true
ZSH_THEME="spaceship"
This would be related #407
@salmanulfarzy Thank you, that worked.
If anyone coming across this has an issue where color doesn't show until zshrc is sourced, make sure settings like SPACESHIP_DIR_PREFIX happen after the theme is sourced.
I was able to reproduce this. Please move SPACESHIP_PROMPT_FIRST_PREFIX_SHOW before sourcing theme.
Can confirm this fixed SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true for me, which wasn't working.
Most helpful comment
I was able to reproduce this. Please move
SPACESHIP_PROMPT_FIRST_PREFIX_SHOWbefore sourcing theme.This would be related #407