Improve startup time in zsh

This commit is contained in:
Tobias Reisinger 2024-06-21 22:38:08 +02:00
parent 0edf379835
commit f7f2b3a020
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
3 changed files with 16 additions and 14 deletions

View file

@ -1,9 +0,0 @@
#!/usr/bin/env sh
base_path="$HOME/.cache/remote-sources"
file_path="$base_path/$2"
autoinstall file "$1" "$file_path"
# shellcheck disable=SC1090
. "$file_path"

View file

@ -71,6 +71,11 @@ AUTOINSTALL_ITEM_SOURCE="https://gist.githubusercontent.com/oshybystyi/475ee7768
AUTOINSTALL_ITEM_TARGET="${plugin_path:?}/git-auto-status/git-auto-status.plugin.zsh" AUTOINSTALL_ITEM_TARGET="${plugin_path:?}/git-auto-status/git-auto-status.plugin.zsh"
AUTOINSTALL_ITEM_GROUPS="oh-my-zsh" AUTOINSTALL_ITEM_GROUPS="oh-my-zsh"
AUTOINSTALL_ITEM_TYPE="exe"
AUTOINSTALL_ITEM_SOURCE="https://raw.githubusercontent.com/dracula/zsh-syntax-highlighting/master/zsh-syntax-highlighting.sh"
AUTOINSTALL_ITEM_TARGET="${plugin_path:?}/zsh-syntax-highlighting.sh"
AUTOINSTALL_ITEM_GROUPS="oh-my-zsh"
AUTOINSTALL_ITEM_TYPE="file" AUTOINSTALL_ITEM_TYPE="file"

View file

@ -1,5 +1,12 @@
STARSHIP_START_TIME=$(starship time) # display shell startup time in starship
source "$HOME/.config/environment" source "$HOME/.config/environment"
omz_installed=false
if [ -d "$ZSH" ]; then
omz_installed=true
fi
autoinstall git "https://github.com/ohmyzsh/ohmyzsh.git" "$ZSH" autoinstall git "https://github.com/ohmyzsh/ohmyzsh.git" "$ZSH"
# Set name of the theme to load --- if set to "random", it will # Set name of the theme to load --- if set to "random", it will
@ -63,7 +70,9 @@ HIST_STAMPS="yyyy-mm-dd"
ZSH_CUSTOM=$ZDOTDIR/custom ZSH_CUSTOM=$ZDOTDIR/custom
export plugin_path="$ZSH_CUSTOM/plugins" export plugin_path="$ZSH_CUSTOM/plugins"
autoinstall run oh-my-zsh if [ $omz_installed = false ]; then
autoinstall run oh-my-zsh
fi
nix_completions="$HOME/.nix-profile/share/zsh/site-functions" nix_completions="$HOME/.nix-profile/share/zsh/site-functions"
if [ -d "$nix_completions" ]; then if [ -d "$nix_completions" ]; then
@ -88,7 +97,6 @@ plugins=(
'git' 'git'
'git-auto-status' 'git-auto-status'
'jump' 'jump'
'laravel5'
'nix-shell' 'nix-shell'
'nix-zsh-completions' 'nix-zsh-completions'
'rust' 'rust'
@ -114,9 +122,7 @@ export SAVEHIST=1000000
export HISTSIZE=1000000 export HISTSIZE=1000000
export HISTFILE="$HOME/.cache/zsh_history" export HISTFILE="$HOME/.cache/zsh_history"
source source-remote-file \ source "$plugin_path/zsh-syntax-highlighting.sh"
"https://raw.githubusercontent.com/dracula/zsh-syntax-highlighting/master/zsh-syntax-highlighting.sh" \
"dracula-syntax-highlighting"
[ -x "$(command -v atuin)" ] && eval "$(atuin init zsh --disable-up-arrow)" [ -x "$(command -v atuin)" ] && eval "$(atuin init zsh --disable-up-arrow)"
[ -x "$(command -v direnv)" ] && eval "$(direnv hook zsh)" [ -x "$(command -v direnv)" ] && eval "$(direnv hook zsh)"