Last active
August 29, 2015 14:06
-
-
Save xbeta/6b79a7f1b9b7a2346997 to your computer and use it in GitHub Desktop.
tmux + iTerm2 integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install tmux 1.8+ | |
# on OSX, use iTerm2 and follow this guide: http://www.railsonmaui.com/blog/2014/03/11/rocking-with-tmux-tmuxinator-and-iterm2-for-rails-development/ | |
# | |
ssh login@hostname -t 'tmux -CC attach || tmux -CC' | |
# Fixing clipboard on OSX | |
brew install reattach-to-user-namespace --wrap-pbcopy-and-pbpaste | |
# Boost Productivity with tmux and iTerm2 workspace | |
# http://www.huyng.com/posts/productivity-boost-with-tmux-iterm2-workspaces/ | |
# First off, place the above script in a location that’s accessible to iTerm2 (I usually place it in ~/.dotfiles/tmux.start.sh | |
#!/bin/sh | |
export PATH=$PATH:/usr/local/bin | |
# abort if we're already inside a TMUX session | |
[ "$TMUX" == "" ] || exit 0 | |
# startup a "default" session if none currently exists | |
tmux has-session -t _default || tmux new-session -s _default -d | |
# present menu for user to choose which workspace to open | |
PS3="Please choose your session: " | |
options=($(tmux list-sessions -F "#S") "NEW SESSION" "BASH" "ZSH") | |
echo "Available sessions" | |
echo "------------------" | |
echo " " | |
select opt in "${options[@]}" | |
do | |
case $opt in | |
"NEW SESSION") | |
read -p "Enter new session name: " SESSION_NAME | |
tmux new -s "$SESSION_NAME" | |
break | |
;; | |
"ZSH") | |
zsh --login | |
break;; | |
"BASH") | |
bash --login | |
break;; | |
*) | |
tmux attach-session -t $opt | |
break | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
~/workspace/lookout-artifactory-cookbook
.chef
~/workspace/bob/
~/go/src/source.flexilis.local/sxiao/orca