added zsh_tmux

This commit is contained in:
Mika Suomalainen 2011-10-01 16:14:11 +03:00
parent 62edb3639d
commit a6df36aa40
3 changed files with 23 additions and 11 deletions

View File

@ -10,6 +10,8 @@ touch ~/.zshenv # Creates .zshenv
cat zshenv > ~/.zshenv.default.backup # Backs up .zsh_exports.
touch ~/.zsh_functions
cat ~/.zsh_functions > ~/.zsh_functions.default.backup # Backs up .zsh_functions .
touch ~/.zsh_tmux
cat ~/.zsh_tmux > ~/.zsh_tmux.default.backup
echo "Done!"
echo "Installing zsh_aliases."
cat zsh_aliases > ~/.zsh_aliases
@ -23,4 +25,7 @@ echo "zsh_exports installed."
echo "Installing zsh_functions"
cat zsh_functions > ~/.zsh_functions
echo "zsh_functions installed."
echo "Installing zsh_tmux..."
cat zsh_tmux > ~/.zsh_tmux
echo "zsh_tmux installed."
echo "Installation has completed. Now run 'source ~/.zshrc' to enable the new things."

17
zsh_tmux Normal file
View File

@ -0,0 +1,17 @@
# Different ways to start tmux on zsh startup.
# Starts tmux always on start of zsh, not only on SSH login, and quits from bash when tmux quits. (Modified from Cubox's script and William Shallum's tmux on SSH login http://william.shallum.net/random-notes/automatically-start-tmux-on-ssh-login )
#if [[ $TERM != "screen" ]]
#then
# tmux has-session -t 0 && tmux attach-session -t 0 || tmux new-session -s 0 && exit
#fi
# Starts tmux on SSH login. (From http://william.shallum.net/random-notes/automatically-start-tmux-on-ssh-login )
# I personally think that this is more suitable for me than that which I made. TIP: replace "remote" with name of server.
if [ "$PS1" != "" -a "${STARTED_TMUX:-x}" = x -a "${SSH_TTY:-x}" != x ]
then
STARTED_TMUX=1; export STARTED_TMUX
sleep 1
( (tmux has-session -t remote && tmux attach-session -t remote) || (tmux new-session -s remote) ) && exit 0
echo "tmux failed to start"
fi

12
zshrc
View File

@ -44,14 +44,4 @@ zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
source ~/.zsh_aliases
source ~/.zshenv
source ~/.zsh_functions
## DO NOT PUT ANYTHING BELOW THIS LINE OR YOUR CHANGES MAY GET IGNORED BY BASH!
#sleep 1;
# Gives second time to press CTRL + C in case you want to prevent action by tmux.
# Starts tmux always on start of bash, not only on SSH login, and quits from bash when tmux quits. WARNING: I DON'T KNOW WHAT HAPPENS IF YOU DON'T HAVE TMUX INSTALLED! (Modified from Cubox's script and William Shallum's tmux on SSH login http://william.shallum.net/random-notes/automatically-start-tmux-on-ssh-login )
#if [[ $TERM != "screen" ]]
#then
# tmux has-session -t 0 && tmux attach-session -t 0 || tmux new-session -s 0 && exit
#fi
source ~/.zsh_tmux