diff --git a/conf.d/25_prompt_theme.fish b/conf.d/25_prompt_theme.fish index f1eec53..25dfcb8 100644 --- a/conf.d/25_prompt_theme.fish +++ b/conf.d/25_prompt_theme.fish @@ -1,14 +1,6 @@ # 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 compact -#set -g FISH_PROMPT_THEME minimaline -set -l theme_dir ~/.config/fish/themes/$FISH_PROMPT_THEME - -source $theme_dir/prompt.fish - -if test -f $theme_dir/right_prompt.fish - source $theme_dir/right_prompt.fish -end \ No newline at end of file +fish_load_theme $FISH_PROMPT_THEME \ No newline at end of file diff --git a/functions/fish_load_theme.fish b/functions/fish_load_theme.fish new file mode 100644 index 0000000..49debed --- /dev/null +++ b/functions/fish_load_theme.fish @@ -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 " >&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 \ No newline at end of file