diff options
-rw-r--r-- | git-prompt.conf | 13 | ||||
-rwxr-xr-x | git-prompt.sh | 13 |
2 files changed, 13 insertions, 13 deletions
diff --git a/git-prompt.conf b/git-prompt.conf index 783a5b3..a9061ab 100644 --- a/git-prompt.conf +++ b/git-prompt.conf @@ -27,13 +27,10 @@ ## default_host="ahp" # remote host is always shown ## default_domain="lvvnet" -########################################################### PWD -## the working path will be truncated by cutting of chars -## of the components - -# truncate_pwd=off # =on -# max_pwd_length=30 -# min_chars_per_pwd=1 +########################################################### CWD +## cwd_cmd='\w' # display full path +## cwd_cmd='\W' # display only last dir of path +cwd_cmd='cwd_truncate 40' # display last 30 chars of path ########################################################### ETC @@ -76,4 +73,4 @@ # detached_vcs_color=RED -: vim:ft=sh: +: vim:ft=sh ts=8: diff --git a/git-prompt.sh b/git-prompt.sh index eb6a11b..ce09210 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -160,7 +160,7 @@ cwd_truncate() { [[ $truncate_pwd != "on" ]] && return - local pwd_length=10 + local pwd_length=$1 # Get the current working directory. We'll format it in $dir. local dir="$PWD" @@ -196,7 +196,7 @@ cwd_truncate() { dir="$tilde/...$directory" fi - pwd="$dir" + cwd="$dir" } @@ -576,9 +576,12 @@ prompt_command_function() { set_shell_title "$PWD/" parse_vcs_status - #truncate_working_directory - cwd_truncate - PS1="$colors_reset$rc$head_local$label$color_who_where$dir_color$pwd$tail_local$dir_color> $colors_reset" + + # if cwd_cmd have back-slash, then assign it value to cwd + # else eval cmd_cmd, cwd should have path after exection + eval "${cwd_cmd/\\/cwd=\\\\}" + + PS1="$colors_reset$rc$head_local$label$color_who_where$dir_color$cwd$tail_local$dir_color> $colors_reset" unset head_local tail_local pwd } |