yashrc changes
This commit is contained in:
parent
2524999fd1
commit
0b4571508e
52
.yashrc
52
.yashrc
|
@ -1,52 +1,8 @@
|
|||
COMMAND_NOT_FOUND_HANDLER=()
|
||||
|
||||
alias ls='ls --color'
|
||||
alias la='ls -la'
|
||||
|
||||
_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
|
||||
\command 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
|
||||
}
|
||||
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
|
||||
startx
|
||||
fi
|
||||
|
||||
# Update $_vcs_info on each prompt
|
||||
PROMPT_COMMAND=("$PROMPT_COMMAND" '_update_vcs_info')
|
||||
|
||||
YASH_PS1='[$(uname -n)] ${${${PWD:/~/\~}##*/}:-$PWD} ${{?:/0/}:+\\fr.$?\\fd. } > '
|
||||
YASH_PS1R='\fc.${_vcs_info}'
|
||||
YASH_PS1='[${${${PWD:/~/\~}##*/}:-$PWD}] > '
|
||||
|
|
Loading…
Reference in New Issue