Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (41 sloc) 1.55 KB
if [[ -f /etc/profile ]]; then source /etc/profile ; fi
if [[ -f ~/.bashrc ]]; then source ~/.bashrc ; fi
if [[ -f ~/.bash_profile ]]; then source ~/.bash_profile ; fi
if [[ -f ~/.bash_login ]]; then source ~/.bash_login ; fi
if [[ -f ~/.profile ]]; then source ~/.profile ; fi
if [[ -f ~/.bash_logout ]]; then source ~/.bash_logout ; fi
source ${SSHHOME}/.sshrc.d/bundler.plugin.zsh
source ${SSHHOME}/.sshrc.d/git.plugin.zsh
source ${SSHHOME}/.sshrc.d/unix.plugin.zsh
source ${SSHHOME}/.sshrc.d/vim.plugin.zsh
source ${SSHHOME}/.sshrc.d/sshrc.plugin.zsh
export VIMINIT="let \$MYVIMRC='$SSHHOME/.sshrc.d/vimrc' | source \$MYVIMRC"
export VISUAL=vim
export EDITOR=$VISUAL
# Allow autocd
if [ -n "$ZSH_VERSION" ]; then
setopt autocd
elif [ -n "$BASH_VERSION" ]; then
shopt -s autocd
fi
screenrc() {
local SCREENDIR=/tmp/sshrc_screen
if ! [ -d $SCREENDIR ]; then
rm -rf $SCREENDIR
mkdir -p $SCREENDIR
fi
cp -r $SSHHOME/bashsshrc $SSHHOME/sshrc $SSHHOME/.sshrc $SSHHOME/.sshrc.d $SCREENDIR
if [ -z "$1" ] ; then
# generate random screen name
local SCREENNAME="$(whoami)_$(LC_CTYPE=C tr -dc A-Za-z < /dev/urandom | head -c 8 | xargs)"
else
# screen name as a function argument
local SCREENNAME=$1
fi
# create a new screen
SSHHOME=$SCREENDIR /usr/bin/screen -dmS $SCREENNAME
# load .sshrc and clear screen
SSHHOME=$SCREENDIR /usr/bin/screen -r $SCREENNAME -p 0 -X stuff "source $SCREENDIR/.sshrc"`printf '\015'`
# attach
SSHHOME=$SCREENDIR /usr/bin/screen -r $SCREENNAME
}