From d54e5b487bf1476a4e8cb13a21b8ffd94381593a Mon Sep 17 00:00:00 2001 From: Jon Ringle Date: Wed, 3 Oct 2012 00:43:36 -0400 Subject: [PATCH] Add $head_separator to allow user to put vcs and dir info on separate lines Signed-off-by: Jon Ringle --- git-prompt.conf | 2 ++ git-prompt.sh | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/git-prompt.conf b/git-prompt.conf index dee3c0c..41ae28c 100644 --- a/git-prompt.conf +++ b/git-prompt.conf @@ -12,6 +12,8 @@ # max_file_list_length=100 # in characters # count_only=off # off - display file list; on - display file count # rawhex_len=5 # length of git rawhex revision id display (use 0 to hide it) +# head_separator=' ' # separator between vcs info and dir info +## head_separator='\n' # put vcs info and dir info on separate lines ############################################################ MODULES diff --git a/git-prompt.sh b/git-prompt.sh index f99a1d0..6062f9a 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -25,7 +25,7 @@ virtualenv_module=${virtualenv_module:-on} error_bell=${error_bell:-off} cwd_cmd=${cwd_cmd:-\\w} - + head_separator=${head_separator:- } #### dir, rc, root color cols=`tput colors` # in emacs shell-mode tput colors returns -1 @@ -624,10 +624,10 @@ parse_vcs_status() { fi - head_local="$vcs_color(${vcs_info}$vcs_color${file_list}$vcs_color)" + head_local="$vcs_color(${vcs_info}$vcs_color${file_list}$vcs_color)$head_separator" ### fringes - head_local="${head_local+$vcs_color$head_local }" + head_local="${head_local+$vcs_color$head_local}" #above_local="${head_local+$vcs_color$head_local\n}" #tail_local="${tail_local+$vcs_color $tail_local}${dir_color}" } @@ -704,6 +704,7 @@ prompt_command_function() { # if cwd_cmd have back-slash, then assign it value to cwd # else eval cwd_cmd, cwd should have path after exection eval "${cwd_cmd/\\/cwd=\\\\}" + eval "${head_separator/\\/head_separator=\\\\}" PS1="$colors_reset$rc$head_local$color_who_where$dir_color$cwd$tail_local$dir_color$prompt_char $colors_reset"