-
Notifications
You must be signed in to change notification settings - Fork 0
/
loader.fish
executable file
·42 lines (33 loc) · 1.52 KB
/
loader.fish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function __fishamnium_conditional_load
which $argv[1] >/dev/null 2>/dev/null; and chmod u+x ~/.config/fish/fishamnium/plugins/$argv[2].fish; or chmod u-x ~/.config/fish/fishamnium/plugins/$argv[2].fish
end
# Set defaults
set -x -g FISHAMNIUM_VERSION $(cat ~/.config/fish/fishamnium/version)
test $(count $FISHAMNIUM_PLUGINS) -eq 0; and set -x FISHAMNIUM_PLUGINS $(command ls ~/.config/fish/fishamnium/plugins/*.fish | xargs -n1 basename)
test $(count $FISHAMNIUM_COMPLETIONS) -eq 0; and set -x FISHAMNIUM_COMPLETIONS $(command ls ~/.config/fish/fishamnium/completions/*.fish | xargs -n1 basename)
test -n $FISHAMNIUM_THEME; and set -x FISHAMNIUM_THEME default
# Conditionally load plugins
__fishamnium_conditional_load npm 42_npm
__fishamnium_conditional_load bundle 52_bundler
__fishamnium_conditional_load rails 53_rails
# Load plugins files
set -e -g FISHAMNIUM_LOADED_PLUGINS
for i in $(string split " " "$FISHAMNIUM_PLUGINS")
set source ~/.config/fish/fishamnium/plugins/$i
if test -x $source
set -x -g FISHAMNIUM_LOADED_PLUGINS $FISHAMNIUM_LOADED_PLUGINS $i
source $source
end
end
# Load completions files
set -e -g FISHAMNIUM_LOADED_COMPLETIONS
for i in $(string split " " "$FISHAMNIUM_COMPLETIONS")
set source ~/.config/fish/fishamnium/completions/$i
if test -x $source
set -x -g FISHAMNIUM_LOADED_COMPLETIONS $FISHAMNIUM_LOADED_COMPLETIONS $i
source $source
end
end
# Load theme using starship
set -x -g STARSHIP_CONFIG ~/.config/fish/fishamnium/themes/$FISHAMNIUM_THEME.toml
starship init fish | source