mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
lazier git info
This commit is contained in:
parent
94be104bc9
commit
b6c2437ed3
4 changed files with 20 additions and 5 deletions
5
bash/rc
5
bash/rc
|
|
@ -15,6 +15,11 @@ precmd() {
|
||||||
#clear_incomplete_line
|
#clear_incomplete_line
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chpwd() {
|
||||||
|
__git_ps1_gitdir
|
||||||
|
}
|
||||||
|
chpwd
|
||||||
|
|
||||||
# Make bash check its window size after a process completes
|
# Make bash check its window size after a process completes
|
||||||
shopt -s checkwinsize
|
shopt -s checkwinsize
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,21 @@ __git_ps1_branch() {
|
||||||
echo ${branch##refs/heads/}
|
echo ${branch##refs/heads/}
|
||||||
}
|
}
|
||||||
|
|
||||||
# compute git status and set environment variables
|
__git_ps1_gitdir() {
|
||||||
__git_ps1_vars() {
|
|
||||||
local g="$(__gitdir)"
|
local g="$(__gitdir)"
|
||||||
|
|
||||||
# are we in a git repo?
|
# are we in a git repo?
|
||||||
|
if [[ -z "$g" ]]; then
|
||||||
|
unset GIT_PS1_GITDIR
|
||||||
|
else
|
||||||
|
GIT_PS1_GITDIR="$g"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# compute git status and set environment variables
|
||||||
|
__git_ps1_vars() {
|
||||||
|
local g="$GIT_PS1_GITDIR"
|
||||||
|
|
||||||
if [[ -z "$g" ]]; then
|
if [[ -z "$g" ]]; then
|
||||||
unset GIT_PS1_STATUS
|
unset GIT_PS1_STATUS
|
||||||
unset GIT_PS1_BRANCH
|
unset GIT_PS1_BRANCH
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ prompt_dir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_git() {
|
prompt_git() {
|
||||||
|
__git_ps1_vars
|
||||||
if [[ -n $GIT_PS1_STATUS ]]; then
|
if [[ -n $GIT_PS1_STATUS ]]; then
|
||||||
PROMPT_VCS_TYPE='git'
|
PROMPT_VCS_TYPE='git'
|
||||||
PROMPT_VCS_REF="$GIT_PS1_BRANCH"
|
PROMPT_VCS_REF="$GIT_PS1_BRANCH"
|
||||||
|
|
|
||||||
5
zsh/rc
5
zsh/rc
|
|
@ -17,7 +17,6 @@ source $DOTFILES_SHELL_DIR/git_prompt_info
|
||||||
GIT_PS1_SHOWDIRTYSTATE=1
|
GIT_PS1_SHOWDIRTYSTATE=1
|
||||||
GIT_PS1_SHOWSTASHSTATE=1
|
GIT_PS1_SHOWSTASHSTATE=1
|
||||||
GIT_PS1_SHOWUNTRACKEDFILES=1
|
GIT_PS1_SHOWUNTRACKEDFILES=1
|
||||||
__git_ps1_vars
|
|
||||||
|
|
||||||
precmd() {
|
precmd() {
|
||||||
LAST_CMD_RC=$?
|
LAST_CMD_RC=$?
|
||||||
|
|
@ -32,8 +31,8 @@ preexec() {
|
||||||
}
|
}
|
||||||
|
|
||||||
chpwd() {
|
chpwd() {
|
||||||
__git_ps1_vars
|
__git_ps1_gitdir
|
||||||
#set_term_title
|
|
||||||
}
|
}
|
||||||
|
chpwd
|
||||||
|
|
||||||
# vim: ft=zsh
|
# vim: ft=zsh
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue