summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Volnitsky <Leonid@Volnitsky.com>2009-04-06 11:46:07 +0300
committerLeonid Volnitsky <Leonid@Volnitsky.com>2009-04-06 11:46:07 +0300
commit1de627547fc9e5a38864883c4ef588042a73ea00 (patch)
treebf9dfb40a2863cdca250158533b35ed6326a5b8c
parentterminal error_bell is back (diff)
downloadgit-prompt-1de627547fc9e5a38864883c4ef588042a73ea00.tar.gz
git-prompt-1de627547fc9e5a38864883c4ef588042a73ea00.tar.bz2
git-prompt-1de627547fc9e5a38864883c4ef588042a73ea00.zip
exit code now deisplayed at left-most position; fixed: extranious spase removed
-rw-r--r--Makefile3
-rw-r--r--git-prompt.sh51
2 files changed, 22 insertions, 32 deletions
diff --git a/Makefile b/Makefile
index c0a9e7e..0293330 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
install:
- cp -v git-prompt.{sh,conf} /etc/
+ cp -v git-prompt.sh /etc/
+ [ -f /etc/git-prompt.conf ] || cp -v git-prompt.conf /etc/
tgit:
diff --git a/git-prompt.sh b/git-prompt.sh
index 272d994..96824a1 100644
--- a/git-prompt.sh
+++ b/git-prompt.sh
@@ -223,31 +223,25 @@ set_shell_title() {
#################################################################### WHO_WHERE
- # who_ware. Is constant. Looks like
- # [user@]host[-tty]
+ # [[user@]host[-tty]]
- color_who_where="${id:+$id@}$host_color$host${tty:+ $tty}"
- plain_who_where="${id:+$id@}$host"
-
- # remove trailing "@" if any
- color_who_where="${color_who_where%@}"
- plain_who_where="${plain_who_where%@}"
-
- # add trailing " "
- color_who_where="$color_who_where "
- plain_who_where="$plain_who_where "
-
- # if $who_where==" " then who_where=""
- color_who_where="${color_who_where## }"
- plain_who_where="${plain_who_where## }"
-
-
- # if root then highlight who_where
- if [ "$id" == "root" ] ; then
- color_who_where="$root_id_color$color_who_where$colors_reset"
+ if [[ -n $id || -n $host ]] ; then
+ [[ -n $id && -n $host ]] && at='@' || at=''
+ color_who_where="${id}$at${host:+$host_color$host}${tty:+ $tty}"
+ plain_who_where="${id}$at$host"
+
+ # add trailing " "
+ color_who_where="$color_who_where "
+ plain_who_where="$plain_who_where "
+
+ # if root then make it root_color
+ if [ "$id" == "root" ] ; then
+ color_who_where="$root_id_color$color_who_where$colors_reset"
+ fi
+ else
+ color_who_where=''
fi
-
parse_svn_dir() {
if [[ $svn_module = "off" || ! -d .svn || $HOME == $PWD ]]; then # if home dir under svn - don't clutter home dir prompt
@@ -470,8 +464,8 @@ parse_vcs_dir() {
### fringes (added depended on location)
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}"
+ #above_local="${head_local+$vcs_color$head_local\n}"
+ #tail_local="${tail_local+$vcs_color $tail_local}${dir_color}"
}
@@ -487,13 +481,8 @@ prompt_command_function() {
fi
set_shell_title "$PWD/"
-
parse_vcs_dir
-
- #########################
- # PS1="$label$rc'$color_who_where$dir_color'${head:10*(${#PWD}<max)}${PWD:(${#PWD}>max)*(${#PWD}-max):max}> '$colors_reset'"
-
- PS1="$head_local$colors_reset$label$rc$color_who_where$dir_color\w$tail_local$dir_color> $colors_reset"
+ PS1="$colors_reset$rc$head_local$label$color_who_where$dir_color\w$tail_local$dir_color> $colors_reset"
unset head_local tail_local
}
@@ -501,6 +490,6 @@ prompt_command_function() {
PROMPT_COMMAND=prompt_command_function
- unset rc id tty modified_files file_list
+ unset rc id tty modified_files file_list
# vim: set syntax=sh: