bashrc: Add tmux session function

Remove stand-alone session function in favor of function in bash config
This commit is contained in:
Bill Niblock 2017-11-13 15:25:47 -05:00
parent 197d10505f
commit 0c67db67ae
2 changed files with 29 additions and 31 deletions

View file

@ -51,17 +51,34 @@ function show_git_info(){
echo $results echo $results
fi fi
} }
# Start tmux session: Sojourner
function sojourner_tmux(){
type tmux >/dev/null 2>&1
if [[ $? == 0 ]]; then
tmux has-session -t Sojourner &>/dev/null
# If there is no session named Sojourner
if [ $? != 0 ] ; then
# Create a new session named Sojourner
tmux new-session -s Sojourner -d -c ~/
fi
# Attack to the Sojourner session
tmux attach -t Sojourner
else
echo "Nope. No tmux. Install that sucka"
fi
}
#=============================================================================== #===============================================================================
# Path # Path
#=============================================================================== #===============================================================================
# Ruby Gems # rbenv
if which ruby >/dev/null && which gem >/dev/null; then PATH="$HOME/.rbenv/bin:$PATH"
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi
# RVM
PATH="$HOME/.rvm/bin:$PATH"
# Add Python to path # Add Python to path
PYTHONPATH="${PYTHONPATH}" PYTHONPATH="${PYTHONPATH}"
export PYTHONPATH
# RVM. Make sure this is the last PATH variable change.
PATH="$PATH:$HOME/.rvm/bin"
# Set it.
export PATH
#=============================================================================== #===============================================================================
# Defaults # Defaults
#=============================================================================== #===============================================================================
@ -73,8 +90,11 @@ fi
# History size and time-format # History size and time-format
export HISTSIZE=10000 export HISTSIZE=10000
export HISTTIMEFORMAT="%s " export HISTTIMEFORMAT="%s "
# Paths #===============================================================================
export PYTHONPATH # Random Shit often auto-added
export PATH #===============================================================================
# Hook for desk activation
[ -n "$DESK_ENV" ] && source "$DESK_ENV" || true
# Yubikey support # Yubikey support
export SSH_AUTH_SOCK=$HOME/.yubiagent/sock export SSH_AUTH_SOCK=$HOME/.yubiagent/sock

View file

@ -1,22 +0,0 @@
#!/bin/bash
######
# Sojourner: My Default Session
###
tmux has-session -t Sojourner &>/dev/null
# If there is no session named Sojourner
if [ $? != 0 ]
then
# Create a new session named Sojourner
tmux new-session -s Sojourner -d -c ~/
# Window 1: Triple-pane, top-left is Vim
tmux send-keys -t Sojourner:1.1 'vim' C-m
# Window 2: 4-pane, main-vertical layout
tmux new-window -c ~/
# Window 3: Single, full-size pane
tmux new-window -c ~/
# Focus on the first window, first pane
tmux select-pane -t Sojourner:1.1
fi
# Attack to the Sojourner session
tmux attach -t Sojourner