Skip to content

Commit

Permalink
* TMUX_OUTREPO_STATUS now defaults to tmux status value (kudos to htt…
Browse files Browse the repository at this point in the history
…ps://github.com/danarnold)

* Minor typos and blank linesfixed
  • Loading branch information
Oliver Etchebarne committed Nov 27, 2014
1 parent c645831 commit 34f313f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tmux-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
# Location of the status on tmux bar: left or right
TMUX_STATUS_LOCATION='right'

# Status for where you are out of a repo
TMUX_OUTREPO_STATUS=''
# Status for where you are out of a repo. Default is your pre-existing status
# line. Idea from https://github.com/danarnold
TMUX_OUTREPO_STATUS=$(tmux show -vg status-$TMUX_STATUS_LOCATION)

# Function to build the status line. You need to define the $TMUX_STATUS
# variable.
Expand Down Expand Up @@ -74,9 +75,9 @@ find_git_stash() {
}

update_tmux() {


# Check for tmux session
# Check for tmux session. This if will be removed in future revisions, as
# the verification is now done in the .bashrc file
if [ -n "$TMUX" ]; then

# This only work if the cwd is outside of the last branch
Expand All @@ -101,7 +102,6 @@ update_tmux() {
tmux set-window-option status-$TMUX_STATUS_LOCATION-attr none > /dev/null
fi


tmux set-window-option status-$TMUX_STATUS_LOCATION "$TMUX_STATUS" > /dev/null

else
Expand All @@ -111,11 +111,17 @@ update_tmux() {
export TMUX_GIT_LASTREPO="$GIT_REPO"
update_tmux
else
# Be sure to unset GIT_DIRTY's bright when leaving a repository.
# Idea from https://github.com/danarnold
tmux set-window-option status-$TMUX_STATUS_LOCATION-attr none > /dev/null

# Set the out-repo status
tmux set-window-option status-$TMUX_STATUS_LOCATION "$TMUX_OUTREPO_STATUS" > /dev/null

fi
fi
fi

}

# Update the prompt for execute the script
PROMPT_COMMAND="update_tmux; $PROMPT_COMMAND"

0 comments on commit 34f313f

Please sign in to comment.