From a49c22116ccd6108653869787f2ea44620ae6b9a Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Fri, 21 Feb 2020 10:57:11 -0800 Subject: [PATCH] Improve fish startup time --- assets/default/fish/init.fish | 2 +- assets/default/fish/init/paths.fish | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/assets/default/fish/init.fish b/assets/default/fish/init.fish index 551cb5c..080411d 100644 --- a/assets/default/fish/init.fish +++ b/assets/default/fish/init.fish @@ -2,5 +2,5 @@ set -gx fish_function_path "$fish_synced_dir/functions" $fish_function_path set -gx fish_complete_path "$fish_synced_dir/completions" $fish_complete_path source_synced 'init/alias' -source_synced 'init/env' source_synced 'init/paths' +source_synced 'init/env' diff --git a/assets/default/fish/init/paths.fish b/assets/default/fish/init/paths.fish index 936702e..57a7b17 100644 --- a/assets/default/fish/init/paths.fish +++ b/assets/default/fish/init/paths.fish @@ -31,9 +31,13 @@ end # NPM paths if type -q npm - set npm_path (npm bin -g 2> /dev/null) + set npm_path "$HOME/.npm/bin" + if [ ! -d "$npm_path" ] + # It's more robust to use the subshell, but far slower + set npm_path (npm bin -g 2> /dev/null) + end if [ -d "$npm_path" ] - set -gx PATH $npm_path $PATH + set -gx PATH $PATH $npm_path end end @@ -66,6 +70,7 @@ end if [ -d "$HOME/.local/bin" ] set -gx PATH $HOME/.local/bin $PATH end + if [ -d "$HOME/bin" ] set -gx PATH $HOME/bin $PATH end