Enable iTerm2 tmux integration

Signed-off-by: Sorin Ionescu <sorin.ionescu@gmail.com>
This commit is contained in:
Daniel Kolakowski 2014-11-07 00:15:23 +01:00 committed by Sorin Ionescu
parent 3cb1f7c4c9
commit 00a5639e65
3 changed files with 22 additions and 2 deletions

View file

@ -30,6 +30,15 @@ in *tmux.conf*:
set-option -g destroy-unattached [on | off] set-option -g destroy-unattached [on | off]
#### iTerm2 Integration
[iTerm2][6] offers significant integration with tmux. This can be enabled by
adding the following line to *zpreztorc*:
zstyle ':prezto:module:tmux:iterm' integrate 'yes'
Read [iTerm2 and tmux Integration][7] for more information.
Aliases Aliases
------- -------
@ -64,3 +73,5 @@ Authors
[3]: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard [3]: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
[4]: https://github.com/mxcl/homebrew [4]: https://github.com/mxcl/homebrew
[5]: https://github.com/sorin-ionescu/prezto/issues [5]: https://github.com/sorin-ionescu/prezto/issues
[6]: http://iterm2.com
[7]: https://code.google.com/p/iterm2/wiki/TmuxIntegration

View file

@ -17,6 +17,12 @@ fi
# Auto Start # Auto Start
# #
if ([[ "$TERM_PROGRAM" = 'iTerm.app' ]] && \
zstyle -t ':prezto:module:tmux:iterm' integrate \
); then
_tmux_iterm_integration='-CC'
fi
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) || ( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) ||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \ ( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \
@ -32,12 +38,12 @@ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \
fi fi
# Attach to the 'prezto' session or to the last session used. # Attach to the 'prezto' session or to the last session used.
exec tmux attach-session exec tmux "$_tmux_iterm_integration" attach-session
fi fi
# #
# Aliases # Aliases
# #
alias tmuxa='tmux attach-session' alias tmuxa="tmux $_tmux_iterm_integration attach-session"
alias tmuxl='tmux list-sessions' alias tmuxl='tmux list-sessions'

View file

@ -152,3 +152,6 @@ zstyle ':prezto:module:prompt' theme 'sorin'
# Auto start a session when Zsh is launched in a SSH connection. # Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:tmux:auto-start' remote 'yes' # zstyle ':prezto:module:tmux:auto-start' remote 'yes'
# Integrate with iTerm2.
# zstyle ':prezto:module:tmux:iterm' integrate 'yes'