Skip to content

Commit

Permalink
Move the tmux stuff out to it's own file which can be included via the
Browse files Browse the repository at this point in the history
.profile.local
  • Loading branch information
Lori Holden committed Feb 12, 2012
1 parent efff81b commit 1484e9b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
25 changes: 1 addition & 24 deletions bash/dot_profile
@@ -1,5 +1,3 @@
[[ -s $HOME/.profile.local ]] && source $HOME/.profile.local

export CLICOLOR=1 export CLICOLOR=1
export LANG="en_US.UTF-8" export LANG="en_US.UTF-8"
export EDITOR="vim" export EDITOR="vim"
Expand All @@ -19,28 +17,7 @@ HISTFILESIZE=2000
# update the values of LINES and COLUMNS. # update the values of LINES and COLUMNS.
shopt -s checkwinsize shopt -s checkwinsize


if [[ -z "$TMUX" ]] && [[ -x `which tmux 2> /dev/null` ]]; then [[ -s $HOME/.profile.local ]] && source $HOME/.profile.local
session_base=lori
# Find stale sessions and let them die
old_sessions=$(tmux ls 2>/dev/null | egrep "^[0-9]{14}.*[0-9]+\)$" | cut -f 1 -d:)
for old_session_id in $old_sessions; do
tmux kill-session -t $old_session_id
done

# Become our base session if we are the first ones here
tmux has-session -t $session_base
if [[ $? -eq 1 ]]; then
tmux new-session -s $session_base
else
session_id="$(date +%Y%m%d%H%M%S)$$"
tmux new-session -d -t $session_base -s $session_id
tmux new-window -t $session_id
tmux attach-session -t $session_id
tmux kill-session -t $session_id
fi
exit
fi

[[ -s $HOME/.prompt ]] && source $HOME/.prompt [[ -s $HOME/.prompt ]] && source $HOME/.prompt
[[ -s /etc/bash_completion ]] && source /etc/bash_completion [[ -s /etc/bash_completion ]] && source /etc/bash_completion
[[ -x `which brew 2> /dev/null` ]] && [[ -s `brew --prefix`/etc/bash_completion ]] && source `brew --prefix`/etc/bash_completion [[ -x `which brew 2> /dev/null` ]] && [[ -s `brew --prefix`/etc/bash_completion ]] && source `brew --prefix`/etc/bash_completion
Expand Down
21 changes: 21 additions & 0 deletions bash/dot_profile.tmux
@@ -0,0 +1,21 @@
if [[ -z "$TMUX" ]] && [[ -x `which tmux 2> /dev/null` ]]; then
session_base=lori
# Find stale sessions and let them die
old_sessions=$(tmux ls 2>/dev/null | egrep "^[0-9]{14}.*[0-9]+\)$" | cut -f 1 -d:)
for old_session_id in $old_sessions; do
tmux kill-session -t $old_session_id
done

# Become our base session if we are the first ones here
tmux has-session -t $session_base
if [[ $? -eq 1 ]]; then
tmux new-session -s $session_base
else
session_id="$(date +%Y%m%d%H%M%S)$$"
tmux new-session -d -t $session_base -s $session_id
tmux new-window -t $session_id
tmux attach-session -t $session_id
tmux kill-session -t $session_id
fi
exit
fi

0 comments on commit 1484e9b

Please sign in to comment.