Function: fish_load_theme
- Better way to load themes - Load themes in a running session
This commit is contained in:
parent
55b74b9567
commit
fd4bb034d8
@ -1,14 +1,6 @@
|
|||||||
# Prompt theme
|
# Prompt theme
|
||||||
|
|
||||||
# Change "default" to preferred theme name
|
# Set the theme name. Default: "default"
|
||||||
set -g FISH_PROMPT_THEME default
|
set -g FISH_PROMPT_THEME default
|
||||||
#set -g FISH_PROMPT_THEME compact
|
|
||||||
#set -g FISH_PROMPT_THEME minimaline
|
|
||||||
|
|
||||||
set -l theme_dir ~/.config/fish/themes/$FISH_PROMPT_THEME
|
fish_load_theme $FISH_PROMPT_THEME
|
||||||
|
|
||||||
source $theme_dir/prompt.fish
|
|
||||||
|
|
||||||
if test -f $theme_dir/right_prompt.fish
|
|
||||||
source $theme_dir/right_prompt.fish
|
|
||||||
end
|
|
||||||
25
functions/fish_load_theme.fish
Normal file
25
functions/fish_load_theme.fish
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
function fish_load_theme --description "Load a Fish prompt theme"
|
||||||
|
if test (count $argv) -ne 1
|
||||||
|
echo "Usage: fish_load_theme <theme>" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
set -l theme $argv[1]
|
||||||
|
set -l theme_dir $__fish_config_dir/themes/$theme
|
||||||
|
|
||||||
|
if not test -d $theme_dir
|
||||||
|
echo "fish_load_theme: Theme '$theme' not found." >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if not test -f $theme_dir/prompt.fish
|
||||||
|
echo "fish_load_theme: Theme '$theme' has no prompt.fish." >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
source $theme_dir/prompt.fish
|
||||||
|
|
||||||
|
if test -f $theme_dir/right_prompt.fish
|
||||||
|
source $theme_dir/right_prompt.fish
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user