summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Volnitsky <Leonid@Volnitsky.com>2009-11-30 08:38:19 +0200
committerLeonid Volnitsky <Leonid@Volnitsky.com>2009-11-30 08:38:19 +0200
commite9c8add9f25a0ecd4caa2ee5d1d120c43956983a (patch)
treeee93c54e857c8fc211d21c5bf123075791bd1a0f
parentGet rid of extranious status line updates, while script (usually (diff)
downloadgit-prompt-e9c8add9f25a0ecd4caa2ee5d1d120c43956983a.tar.gz
git-prompt-e9c8add9f25a0ecd4caa2ee5d1d120c43956983a.tar.bz2
git-prompt-e9c8add9f25a0ecd4caa2ee5d1d120c43956983a.zip
reverted prompt char to old default '>'
-rw-r--r--git-prompt.conf7
-rwxr-xr-xgit-prompt.sh33
2 files changed, 15 insertions, 25 deletions
diff --git a/git-prompt.conf b/git-prompt.conf
index bdae7d5..dd88fd0 100644
--- a/git-prompt.conf
+++ b/git-prompt.conf
@@ -27,7 +27,7 @@
## default_host="ahp" # remote host is always shown
## default_domain="lvvnet"
-########################################################### CWD
+########################################################### Current Working Dir display
# cwd_cmd='\w' # display full path
## cwd_cmd='\W' # display only last dir of path
## cwd_cmd='cwd_truncate 40' # display only last N chars of path
@@ -57,10 +57,11 @@
# rc_color=bw_bold
# fi
-### prompt character, default '>' for regular user, '#' for root
+### prompt character for root/non-root, default '>' for both
# prompt_char='>'
+# root_prompt_char='>'
## prompt_char='$'
-# root_prompt_char='#'
+## root_prompt_char='#'
##### Per host color
diff --git a/git-prompt.sh b/git-prompt.sh
index 95b0f08..5a7591c 100755
--- a/git-prompt.sh
+++ b/git-prompt.sh
@@ -25,27 +25,25 @@
#### dir, rc, root color
- #### alexg: removed prefixing 0 to `tput colors`,
- #### in emacs shell-mode tput colors returns -1
- cols=`tput colors`
- if [[ -n "$cols" && $cols -ge 8 ]]; then # if terminal supports colors
+ cols=`tput colors` # in emacs shell-mode tput colors returns -1
+ if [[ -n "$cols" && $cols -ge 8 ]]; then # if terminal supports colors
dir_color=${dir_color:-CYAN}
rc_color=${rc_color:-red}
user_id_color=${user_id_color:-blue}
root_id_color=${root_id_color:-magenta}
- else # only B/W
+ else # only B/W
dir_color=${dir_color:-bw_bold}
rc_color=${rc_color:-bw_bold}
fi
unset cols
- #### prompt character, default '>' for user, '#' for root
+ #### prompt character, for root/non-root
prompt_char=${prompt_char:-'>'}
- root_prompt_char=${root_prompt_char:-'#'}
+ root_prompt_char=${root_prompt_char:-'>'}
#### vcs state colors
- init_vcs_color=${init_vcs_color:-WHITE} # initial
- clean_vcs_color=${clean_vcs_color:-blue} # nothing to commit (working directory clean)
+ init_vcs_color=${init_vcs_color:-WHITE} # initial
+ clean_vcs_color=${clean_vcs_color:-blue} # nothing to commit (working directory clean)
modified_vcs_color=${modified_vcs_color:-red} # Changed but not updated:
added_vcs_color=${added_vcs_color:-green} # Changes to be committed:
addmoded_vcs_color=${addmoded_vcs_color:-yellow}
@@ -81,8 +79,7 @@
# terminfo colors - number of colors
#
################# Colors-256
- # To use foreground and background colors from the extension, you only
- # have to remember two escape codes:
+ # To use foreground and background colors:
# Set the foreground color to index N: \033[38;5;${N}m
# Set the background color to index M: \033[48;5;${M}m
# To make vim aware of a present 256 color extension, you can either set
@@ -115,15 +112,9 @@
on=''
off=': '
-
bell="\[`eval ${!error_bell} tput bel`\]"
-
colors_reset='\['`tput sgr0`'\]'
- # Workaround for UTF readline(?) bug. Disable bell when UTF
- #locale |grep -qi UTF && bell=''
-
-
# replace symbolic colors names to raw treminfo strings
init_vcs_color=${!init_vcs_color}
modified_vcs_color=${!modified_vcs_color}
@@ -134,14 +125,11 @@
addmoded_vcs_color=${!addmoded_vcs_color}
detached_vcs_color=${!detached_vcs_color}
-
unset PROMPT_COMMAND
####### work around for MC bug.
####### specifically exclude emacs, want full when running inside emacs
- if [[ -z "$TERM" || \
- ("$TERM" = "dumb" && -z "$INSIDE_EMACS") || \
- -n "$MC_SID" ]]; then
+ if [[ -z "$TERM" || ("$TERM" = "dumb" && -z "$INSIDE_EMACS") || -n "$MC_SID" ]]; then
unset PROMPT_COMMAND
PS1="\w$prompt_char "
return 0
@@ -547,6 +535,7 @@ parse_vcs_status() {
### VIM
if [[ $vim_module = "on" ]] ; then
+ # equivalent to vim_glob=`ls .*.vim` but without running ls
unset vim_glob vim_file vim_files
old_nullglob=`shopt -p nullglob`
shopt -s nullglob
@@ -556,7 +545,7 @@ parse_vcs_status() {
if [[ $vim_glob ]]; then
vim_file=${vim_glob#.}
vim_file=${vim_file%.swp}
- # if swap is newer, then unsaved vim session
+ # if swap is newer, then this is unsaved vim session
[[ .${vim_file}.swp -nt $vim_file ]] && vim_files=$vim_file
fi
fi