From 9e55d5f3e0c170c06fe15dee8e3839f49a450235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Smyku=C5=82a?= Date: Thu, 30 May 2013 23:33:32 +0200 Subject: [PATCH] Refactor --- gitprompt.fish | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/gitprompt.fish b/gitprompt.fish index b55a272..7bcfe54 100644 --- a/gitprompt.fish +++ b/gitprompt.fish @@ -4,25 +4,22 @@ end # Colors # Reset -set ResetColor (set_color normal) # Text Reset +set ResetColor (set_color normal) # Text Reset # Regular Colors -set Red (set_color red) # Red -set Yellow (set_color yellow); # Yellow -set Blue (set_color blue) # Blue +set Red (set_color red) # Red +set Yellow (set_color yellow); # Yellow +set Blue (set_color blue) # Blue set WHITE (set_color white) # Bold -set BGreen (set_color -o green) # Green +set BGreen (set_color -o green) # Green # High Intensty -set IBlack (set_color -o black) # Black +set IBlack (set_color -o black) # Black # Bold High Intensty -set Magenta (set_color -o purple) # Purple - -# Various variables you might want for your PS1 prompt instead -set Time (date +%R) +set Magenta (set_color -o purple) # Purple # Default values for the appearance of the prompt. Configure at will. set GIT_PROMPT_PREFIX "[" @@ -36,16 +33,18 @@ set GIT_PROMPT_REMOTE " " set GIT_PROMPT_UNTRACKED "…" set GIT_PROMPT_CLEAN "$BGreen✔" -#Not applied two lines conention from https://github.com/magicmonty/bash-git-prompt/pull/5/files +function fish_prompt + + # Various variables you might want for your PS1 prompt instead + set Time (date +%R) + set PathShort (pwd|sed "s=$HOME=~=") -set PROMPT_END " \n$WHITE$Time$ResetColor \$ " + set PROMPT_START "$Yellow$PathShort$ResetColor" + set PROMPT_END " \n$WHITE$Time$ResetColor \$ " -function fish_prompt set -e __CURRENT_GIT_STATUS set gitstatus "$__GIT_PROMPT_DIR/gitstatus.py" - set PROMPT_START "$Yellow" - set _GIT_STATUS (python $gitstatus) set __CURRENT_GIT_STATUS $_GIT_STATUS @@ -95,11 +94,13 @@ function fish_prompt set STATUS "$STATUS$ResetColor$GIT_PROMPT_SUFFIX" - set PS1 "$PROMPT_START"(pwd|sed "s=$HOME=~=")"$ResetColor$STATUS$PROMPT_END" + set PS1 "$PROMPT_START$STATUS$PROMPT_END" else - set PS1 "$PROMPT_START"(pwd|sed "s=$HOME=~=")"$ResetColor$PROMPT_END" + set PS1 "$PROMPT_START$PROMPT_END" end + echo -e $PS1 + end