From 60089f9750f400b1aa92be2fb7699b8760bbd8ca Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 31 Aug 2015 21:23:15 +0200 Subject: Remove setup outside of fish_prompt from sample prompts This doesn't work with fish_config. For terlar and pythonista, remove unnecessary color setting. For informative+git and pythonista, move variable setup into fish_prompt Fixes #1141 --- .../web_config/sample_prompts/informative_git.fish | 70 ++++++++++++++++------ .../web_config/sample_prompts/pythonista.fish | 10 +--- share/tools/web_config/sample_prompts/terlar.fish | 3 - 3 files changed, 55 insertions(+), 28 deletions(-) (limited to 'share/tools') diff --git a/share/tools/web_config/sample_prompts/informative_git.fish b/share/tools/web_config/sample_prompts/informative_git.fish index 0fa5993e..4562ef36 100644 --- a/share/tools/web_config/sample_prompts/informative_git.fish +++ b/share/tools/web_config/sample_prompts/informative_git.fish @@ -1,29 +1,63 @@ # name: Informative Git Prompt # author: Mariusz Smykula -set -g __fish_git_prompt_show_informative_status 1 -set -g __fish_git_prompt_hide_untrackedfiles 1 -set -g __fish_git_prompt_color_branch magenta --bold -set -g __fish_git_prompt_showupstream "informative" -set -g __fish_git_prompt_char_upstream_ahead "↑" -set -g __fish_git_prompt_char_upstream_behind "↓" -set -g __fish_git_prompt_char_upstream_prefix "" -set -g __fish_git_prompt_char_stagedstate "●" -set -g __fish_git_prompt_char_dirtystate "✚" -set -g __fish_git_prompt_char_untrackedfiles "…" -set -g __fish_git_prompt_char_conflictedstate "✖" -set -g __fish_git_prompt_char_cleanstate "✔" +function fish_prompt --description 'Write out the prompt' + if not set -q __fish_git_prompt_show_informative_status + set -g __fish_git_prompt_show_informative_status 1 + end + if not set -q __fish_git_prompt_hide_untrackedfiles + set -g __fish_git_prompt_hide_untrackedfiles 1 + end -set -g __fish_git_prompt_color_dirtystate blue -set -g __fish_git_prompt_color_stagedstate yellow -set -g __fish_git_prompt_color_invalidstate red -set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal -set -g __fish_git_prompt_color_cleanstate green --bold + if not set -q __fish_git_prompt_color_branch + set -g __fish_git_prompt_color_branch magenta --bold + end + if not set -q __fish_git_prompt_showupstream + set -g __fish_git_prompt_showupstream "informative" + end + if not set -q __fish_git_prompt_char_upstream_ahead + set -g __fish_git_prompt_char_upstream_ahead "↑" + end + if not set -q __fish_git_prompt_char_upstream_behind + set -g __fish_git_prompt_char_upstream_behind "↓" + end + if not set -q __fish_git_prompt_char_upstream_prefix + set -g __fish_git_prompt_char_upstream_prefix "" + end + if not set -q __fish_git_prompt_char_stagedstate + set -g __fish_git_prompt_char_stagedstate "●" + end + if not set -q __fish_git_prompt_char_dirtystate + set -g __fish_git_prompt_char_dirtystate "✚" + end + if not set -q __fish_git_prompt_char_untrackedfiles + set -g __fish_git_prompt_char_untrackedfiles "…" + end + if not set -q __fish_git_prompt_char_conflictedstate + set -g __fish_git_prompt_char_conflictedstate "✖" + end + if not set -q __fish_git_prompt_char_cleanstate + set -g __fish_git_prompt_char_cleanstate "✔" + end -function fish_prompt --description 'Write out the prompt' + if not set -q __fish_git_prompt_color_dirtystate + set -g __fish_git_prompt_color_dirtystate blue + end + if not set -q __fish_git_prompt_color_stagedstate + set -g __fish_git_prompt_color_stagedstate yellow + end + if not set -q __fish_git_prompt_color_invalidstate + set -g __fish_git_prompt_color_invalidstate red + end + if not set -q __fish_git_prompt_color_untrackedfiles + set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal + end + if not set -q __fish_git_prompt_color_cleanstate + set -g __fish_git_prompt_color_cleanstate green --bold + end set -l last_status $status diff --git a/share/tools/web_config/sample_prompts/pythonista.fish b/share/tools/web_config/sample_prompts/pythonista.fish index 63a7ced7..ad772e2f 100644 --- a/share/tools/web_config/sample_prompts/pythonista.fish +++ b/share/tools/web_config/sample_prompts/pythonista.fish @@ -1,15 +1,11 @@ # name: Simple Pythonista # author: davbo -set normal (set_color normal) -set magenta (set_color magenta) -set yellow (set_color yellow) -set green (set_color green) -set gray (set_color -o black) - -set -g VIRTUAL_ENV_DISABLE_PROMPT true function fish_prompt + if not set -q VIRTUAL_ENV_DISABLE_PROMPT + set -g VIRTUAL_ENV_DISABLE_PROMPT true + end set_color yellow printf '%s' (whoami) set_color normal diff --git a/share/tools/web_config/sample_prompts/terlar.fish b/share/tools/web_config/sample_prompts/terlar.fish index fb5de11e..d75b17b5 100644 --- a/share/tools/web_config/sample_prompts/terlar.fish +++ b/share/tools/web_config/sample_prompts/terlar.fish @@ -1,9 +1,6 @@ # name: Terlar # author: terlar - https://github.com/terlar -set -g fish_color_user magenta -set -g fish_color_host yellow - function fish_prompt --description 'Write out the prompt' set -l last_status $status -- cgit v1.2.3