commit 1228ff5748caca99e4657150e722765fafa272d2
parent 5a82866fb2a43bc3994cb1264214342148332d73
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 25 Oct 2019 09:16:58 +0200
Remove VCS info from yash prompt, move PWD to right side
Diffstat:
M | .yashrc | | | 52 | ++++------------------------------------------------ |
1 file changed, 4 insertions(+), 48 deletions(-)
diff --git a/.yashrc b/.yashrc
@@ -68,9 +68,10 @@ fi
# The main prompt ($YASH_PS1) contains the username, hostname, working
# directory, last exit status (only if non-zero), and $SHLVL (only if
# non-one).
-YASH_PS1=$_uc'${LOGNAME}'$_hc'@${HOSTNAME%%.*}\fb. '\
-'${${${PWD:/~/\~}##*/}:-$PWD}\fd. ${{?:/0/}:+\\fr.$?\\fd. }${{SHLVL-0}:/1}\$ '
-YASH_PS1R='\fc.${_vcs_info}'
+YASH_PS1=$_uc'${LOGNAME}'$_hc'@${HOSTNAME%%.*}\fd. '\
+'${{?:/0/}:+\\fr.$?\\fd. }${{SHLVL-0}:/1}\$ '
+#YASH_PS1R='\fc.${_vcs_info}'
+YASH_PS1R='\fb.${PWD}'
YASH_PS1S='\fo.'
YASH_PS2=$_2c'> '
#YASH_PS2R=
@@ -80,48 +81,3 @@ YASH_PS4S='\fmo.'
unset _hc _uc _2c
# No escape sequences allowed in the POSIXly-correct mode.
PS1='${LOGNAME}@${HOSTNAME%%.*} '$PS1
-
-# define function that updates $_vcs_info and $_vcs_root
-_update_vcs_info() {
- typeset type branch
- {
- read --raw-mode type
- read --raw-mode _vcs_root
- read --raw-mode branch
- } <(
- exec 2>/dev/null
- typeset COMMAND_NOT_FOUND_HANDLER=
- while true; do
- if [ -e .git ] || [ . -ef "${GIT_WORK_TREE-}" ]; then
- printf 'git\n%s\n' "${GIT_WORK_TREE:-$PWD}"
- git branch --no-color | sed -n '/^\*/s/^..//p'
- exit
- elif [ -d .hg ]; then
- printf 'hg\n%s\n' "$PWD"
- exec cat .hg/branch
- elif [ -d .svn ]; then
- printf 'svn\n'
- _vcs_root=$(svn info --show-item=wc-root)
- printf '%s\n' "$_vcs_root"
- path=$(svn info --show-item=relative-url)
- case $path in
- (*/branches/*)
- printf '%s\n' "${${path#*/branches/}%%/*}"
- esac
- exit
- fi
- if [ / -ef . ] || [ . -ef .. ]; then
- exit
- fi
- cd -P ..
- done
- )
- case "$type#$branch" in
- (hg#default) _vcs_info='hg';;
- (git#master) _vcs_info='git';;
- (*# ) _vcs_info="$type";;
- (* ) _vcs_info="$type@$branch";;
- esac
-}
-# update $_vcs_info on each prompt
-PROMPT_COMMAND=("$PROMPT_COMMAND" '_update_vcs_info')