improve fish startup speed by generating exportenvs.fish
This commit is contained in:
parent
69cf2c98f8
commit
ab2d8ea07d
|
@ -1,8 +1,9 @@
|
|||
source ~/.aliases
|
||||
|
||||
# Environment variables
|
||||
for line in (cat ~/.exportenvs)
|
||||
bass $line
|
||||
# ~/.exportenvs.fish is generated by ~/dotscripts/gen/fish-exportenvs
|
||||
if test -f ~/.exportenvs.fish
|
||||
source ~/.exportenvs.fish
|
||||
end
|
||||
|
||||
if test -f ~/.config/fish/config_local.fish
|
||||
|
|
|
@ -75,7 +75,12 @@ Here are detailed information for each compenent of my dotfiles
|
|||
I don't track `bashrc` or `bash_profile` because I like to keep it to the system's defaults.
|
||||
|
||||
The fish shell configuration is at `.config/fish/` and `config.fish` doesn't really anything specific,
|
||||
it just sources the shared environment variable file (`.exportenvs`) and the shared aliases (`.aliases`).
|
||||
it just sources the shared environment variable file (`.exportenvs.fish`) and the shared aliases (`.aliases`).
|
||||
|
||||
The `.exportenvs.fish` file is generated by [`dotscripts/gen/fish-exportenvs`](dotscripts/gen/fish-exportenvs).
|
||||
It takes [`.exportenvs`](.exportenvs) and translates it into fish syntax. Instead of
|
||||
using bass to source `.exportenvs` on the fly during fish's startup, fish can
|
||||
source the generated `.exportenvs.fish` directly which improves performance signifanctly.
|
||||
|
||||
I have a symlink `.bash_aliases` pointing to `.aliases` because bash likes to look for that file.
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
# Stubbornly translates ~/.exportenvs to ~/.exportenvs.fish
|
||||
|
||||
echo "" > ~/.exportenvs.fish # clear the file
|
||||
|
||||
for fileline in (cat ~/.exportenvs | sed 's/#!.\+$/#!\/usr\/bin\/env fish/')
|
||||
set line (echo "$fileline" | sed 's/export //' | sed 's/#.\+//')
|
||||
if test -z "$line"
|
||||
echo "Adding '$fileline' as-is"
|
||||
echo "$fileline" >> ~/.exportenvs.fish
|
||||
continue
|
||||
end
|
||||
set name (echo "$line" | sed 's/=.\+$//' | sed 's/^$//')
|
||||
set content (echo "$line" | sed 's/^.\+=//' | sed 's/\$(/(/')
|
||||
echo "Adding $name with $content"
|
||||
echo set -x "$name" $content >> ~/.exportenvs.fish
|
||||
end
|
|
@ -25,6 +25,12 @@ fi
|
|||
|
||||
echo Maybe add ~/local/share/man to manpath but I forgot how as of writing
|
||||
|
||||
# env
|
||||
if ! [ -f ~/.exportenvs.fish ]; then
|
||||
echo "Generating ~/.exportenvs.fish"
|
||||
~/dotscripts/gen/fish-exportenvs
|
||||
fi
|
||||
|
||||
# TODO have a better check for omf existence (command -v doesnt work)
|
||||
# Although omf does this same check lol
|
||||
if [ ! -d ~/.local/share/omf ]; then
|
||||
|
|
Loading…
Reference in New Issue