From 72ee1140ec199ac31cc44e2cdbe60039ec8d0689 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Tue, 29 Oct 2013 01:12:47 +0800 Subject: [PATCH 1/2] themes/gitstatus: Fix where it shows extra a space For example, if $HOME is not a git repository, it should show: ~> But previously it incorrectly showed: ~ > This commit makes it aware of such case, inserting the space accordingly instead of always adding a space. --- themes/gitstatus/fish_prompt.fish | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/themes/gitstatus/fish_prompt.fish b/themes/gitstatus/fish_prompt.fish index 17e4b4c..1f5cc12 100644 --- a/themes/gitstatus/fish_prompt.fish +++ b/themes/gitstatus/fish_prompt.fish @@ -28,8 +28,13 @@ end function fish_prompt set -l cyan (set_color cyan) set -l normal (set_color normal) + set -l cwd (set_color $fish_color_cwd)(prompt_pwd) + set -l git_status (_git_status_symbol)(_git_branch_name) + + if test -n "$git_status" + set git_status " $git_status" + end - echo -n (_remote_hostname) \ - $cwd $cyan(_git_status_symbol)(_git_branch_name)$normal'> ' + echo -n (_remote_hostname) $cwd$cyan$git_status$normal'> ' end From 10f36245d151ef2a3c749d4aab7ecc5ef5d2b832 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Tue, 29 Oct 2013 01:33:59 +0800 Subject: [PATCH 2/2] themes/gitstatus: $SSH_CONNECTION could've spaces --- themes/gitstatus/fish_prompt.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/gitstatus/fish_prompt.fish b/themes/gitstatus/fish_prompt.fish index 1f5cc12..e1b7a23 100644 --- a/themes/gitstatus/fish_prompt.fish +++ b/themes/gitstatus/fish_prompt.fish @@ -20,7 +20,7 @@ function _git_status_symbol end function _remote_hostname - if test $SSH_CONNECTION + if test -n "$SSH_CONNECTION" echo (whoami)@(hostname) end end