My shell is kind of slow with the Spaceship theme and it's a bit annoying. I've tried switching to other themes to see if it was other plugins but it doesn't happen.
See the gifs with Pure theme compared to Spaceship.
With Pure theme
With Spaceship theme
As you can see, Spaceship theme is a lot slower and not as fast as what I see in the README's gif.
Even at startup it takes ~0.5s more to load.
Operating system: macOS 10.12.5
Terminal emulator: iTerm2 3.0.15
ZSH version: 5.3.1
ZSH plugin manager: zplug 2.4.1
.zshrc# Path to dotfiles directory.
export DOTFILES=$HOME/.dotfiles
# Initialize zplug.
source ~/.zplug/init.zsh
# Initialize aliases
source ~/.aliases
# 256 colors terminal
export TERM="xterm-256color"
#############################################################
# Env
#############################################################
if [[ -e /usr/libexec/java_home ]]; then
export JAVA_HOME=`/usr/libexec/java_home`
fi
export JAVA_TOOL_OPTIONS='-Djava.awt.headless=true'
#############################################################
# Plugins
#############################################################
# Themes
# zplug "sindresorhus/pure", as:theme, use:"*.zsh"
zplug "denysdovhan/spaceship-zsh-theme", use:spaceship.zsh, from:github, as:theme
# SPACESHIP Theme
SPACESHIP_PROMPT_SYMBOL=โฏ
#SPACESHIP_PROMPT_ADD_NEWLINE=false
#SPACESHIP_PROMPT_SEPARATE_LINE=false
SPACESHIP_DIR_COLOR="081"
zplug "lib/completion", from:oh-my-zsh
zplug "lib/history", from:oh-my-zsh
zplug "lib/key-bindings", from:oh-my-zsh
zplug "lib/theme-and-appearance", from:oh-my-zsh
zplug "lib/spectrum", from:oh-my-zsh
zplug "plugins/git", from:oh-my-zsh, ignore:oh-my-zsh.sh
zplug "plugins/mercurial", from:oh-my-zsh, ignore:oh-my-zsh.sh
zplug "plugins/command-not-found", from:oh-my-zsh, ignore:oh-my-zsh.sh
zplug 'djui/alias-tips'
zplug "zsh-users/zsh-syntax-highlighting", defer:3
# zplug "zsh-users/zsh-autosuggestions"
# Check for uninstalled plugins.
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
# Source plugins.
zplug load
Anything I can do to fix this? I really like the theme and would like to continue using it but not with this kind of lag.
One of the main reason for increased load time is large set of features in spaceship-zsh-theme. We are working on improving the performance of theme in #148 .
For the time being, you could improve loading time by only loading sections relevant to you by specifying SPACESHIP_PROMPT_ORDER. For instance,
SPACESHIP_PROMPT_ORDER=(user host dir git node exec_time line_sep jobs exit_code char)
Please see prompt order, example and presets for more information.
Ok I've tried different combinations with SPACESHIP_PROMPT_ORDER and discovered it's the hg section that slow down the prompt. We are using mercurial at work so I need this. Could you take a look at this?
# Check if the current directory is in a Git repository.
# USAGE:
# _is_git
_is_git() {
command git rev-parse --is-inside-work-tree &>/dev/null
}
# Check if the current direcotory is in a Mercurial repository
# USAGE:
# _is_hg
_is_hg() {
command hg --cwd $PWD root &>/dev/null
}
is_hg() is a bit slower than is_git()
I did the hg section. I've limited knowledge about mercurial and I don't use that much. Highly appreciated if you could help improve hg section. Please take a look at #54, #65 and #156
I'll see what I can do.
Most helpful comment
One of the main reason for increased load time is large set of features in
spaceship-zsh-theme. We are working on improving the performance of theme in #148 .For the time being, you could improve loading time by only loading sections relevant to you by specifying
SPACESHIP_PROMPT_ORDER. For instance,Please see prompt order, example and presets for more information.