gitconfig: add br alias to branch; prompt: remove cabal sandbox

This commit is contained in:
2018-08-09 10:32:30 +02:00
parent c3cfef62ff
commit de054b27af
2 changed files with 4 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
[alias] [alias]
br = branch
ca = commit -a ca = commit -a
cam = commit -am cam = commit -am
changes = diff --name-status -r changes = diff --name-status -r

18
zshrc
View File

@@ -96,10 +96,10 @@ function rprompt-git-current-branch {
if [[ -z $name ]]; then if [[ -z $name ]]; then
return return
fi fi
gitdir=`git rev-parse --git-dir 2> /dev/null` gitdir=`git rev-parse --git-dir 2> /dev/null`
action=`VCS_INFO_git_getaction "$gitdir"` && action="($action)" action=`VCS_INFO_git_getaction "$gitdir"` && action="($action)"
st=`git status 2> /dev/null` st=`git status 2> /dev/null`
if [[ -n `echo "$st" | grep "ahead of"` ]]; then if [[ -n `echo "$st" | grep "ahead of"` ]]; then
color=%F{white} color=%F{white}
@@ -112,24 +112,12 @@ function rprompt-git-current-branch {
else else
color=%B%F{blue} color=%B%F{blue}
fi fi
echo "on %{$fg[white]%}$color$name$action%f%b %{$reset_color%}" echo "on %{$fg[white]%}$color$name$action%f%b %{$reset_color%}"
} }
function cabal_sandbox_info() {
cabal_files=(*.cabal(N))
if [ $#cabal_files -gt 0 ]; then
if [ -f cabal.sandbox.config ]; then
echo "%{$fg[white]%} is %{$fg[green]%}sandboxed%{$reset_color%}"
else
echo "%{$fg[white]%} is %{$fg[red]%}not sandboxed%{$reset_color%}"
fi
fi
}
RPROMPT='`rprompt-git-current-branch`' RPROMPT='`rprompt-git-current-branch`'
RPROMPT+="%{$fg[white]%}in %{$fg[yellow]%}%~%{$reset_color%}" RPROMPT+="%{$fg[white]%}in %{$fg[yellow]%}%~%{$reset_color%}"
RPROMPT+='`cabal_sandbox_info`'
extract(){ extract(){
if [ -f $1 ] ; then if [ -f $1 ] ; then