From 43fb6603cb7533a6de68ef57ebb098dcef94a672 Mon Sep 17 00:00:00 2001 From: Oli Morris Date: Mon, 2 Dec 2024 11:23:31 +0000 Subject: [PATCH] refactor(fish): improve config speed time --- .config/fish/config.fish | 54 ++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/.config/fish/config.fish b/.config/fish/config.fish index f61fd20..58c525f 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -1,5 +1,4 @@ - -set -u fish_greeting "" +set -g fish_greeting "" # Variables set -x GPG_TTY (tty) @@ -8,41 +7,36 @@ set -x DOTNET_CLI_TELEMETRY_OPTOUT 1 set -x HOMEBREW_NO_ANALYTICS 1 set -x GOPATH "$HOME/Code/Go" set -x STARSHIP_CONFIG "$HOME/.config/starship/starship.toml" -set -gx macOS_Theme (cat $HOME/.color_mode | string collect) - -set fish_color_param cyan -set fish_pager_color_completion blue --bold -set fish_color_normal black -set fish_color_error red -set fish_color_comment gray -set fish_color_autosuggestion gray - -if [ "$macOS_Theme" = light ] - set -x LS_COLORS "vivid generate $HOME/.config/vivid/onelight.yml" -else - set -x LS_COLORS "vivid generate $HOME/.config/vivid/onedark.yml" -end +# set -gx macOS_Theme (cat $HOME/.color_mode | string collect) + +set -g fish_color_param cyan +set -g fish_color_normal black +set -g fish_color_error red +set -g fish_color_comment gray +set -g fish_color_autosuggestion gray +set -g fish_pager_color_completion blue --bold + +# if [ "$macOS_Theme" = light ] +# set -x LS_COLORS "vivid generate $HOME/.config/vivid/onelight.yml" +# else +# set -x LS_COLORS "vivid generate $HOME/.config/vivid/onedark.yml" +# end -# Paths -fish_add_path /opt/homebrew/bin -fish_add_path /opt/homebrew/sbin -fish_add_path "$HOME/.cargo/bin" -fish_add_path "$HOME/.dotfiles/bin" -fish_add_path "$HOME/.local/share/nvim/mason/bin" -fish_add_path "$HOME/.local/share/bob/nvim-bin" + # Paths +fish_add_path -p /opt/homebrew/sbin /opt/homebrew/bin "$HOME/.cargo/bin" "$HOME/.dotfiles/bin" "$HOME/.local/share/nvim/mason/bin" "$HOME/.local/share/bob/nvim-bin" source $HOME/.config/fish/fzf.fish source $HOME/.config/fish/aliases.fish source $HOME/.config/fish/functions.fish -if type -q zoxide - zoxide init fish | source - set -x _ZO_DATA_DIR "$HOME/.local/share/zoxide" - set -x _ZO_ECHO 1 - set -x _ZO_RESOLVE_SYMLINKS 1 -end - if status is-interactive load_env_vars ~/.env + + # Cache zoxide init output + source ~/.cache/zoxide.fish 2>/dev/null; or begin + zoxide init fish > ~/.cache/zoxide.fish + source ~/.cache/zoxide.fish + end + starship init fish | source end