From 00a5639e65e19b683b60174b321f10bb68c1632a Mon Sep 17 00:00:00 2001 From: Daniel Kolakowski Date: Fri, 7 Nov 2014 00:15:23 +0100 Subject: [PATCH] Enable iTerm2 tmux integration Signed-off-by: Sorin Ionescu --- modules/tmux/README.md | 11 +++++++++++ modules/tmux/init.zsh | 10 ++++++++-- runcoms/zpreztorc | 3 +++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/tmux/README.md b/modules/tmux/README.md index 9a15be0..b2f6bc8 100644 --- a/modules/tmux/README.md +++ b/modules/tmux/README.md @@ -30,6 +30,15 @@ in *tmux.conf*: 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 ------- @@ -64,3 +73,5 @@ Authors [3]: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard [4]: https://github.com/mxcl/homebrew [5]: https://github.com/sorin-ionescu/prezto/issues +[6]: http://iterm2.com +[7]: https://code.google.com/p/iterm2/wiki/TmuxIntegration diff --git a/modules/tmux/init.zsh b/modules/tmux/init.zsh index 29b547f..ac944f6 100644 --- a/modules/tmux/init.zsh +++ b/modules/tmux/init.zsh @@ -17,6 +17,12 @@ fi # 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" ]] && ( \ ( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) || ( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \ @@ -32,12 +38,12 @@ if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" ]] && ( \ fi # Attach to the 'prezto' session or to the last session used. - exec tmux attach-session + exec tmux "$_tmux_iterm_integration" attach-session fi # # Aliases # -alias tmuxa='tmux attach-session' +alias tmuxa="tmux $_tmux_iterm_integration attach-session" alias tmuxl='tmux list-sessions' diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index a54fdb0..4778944 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -152,3 +152,6 @@ zstyle ':prezto:module:prompt' theme 'sorin' # Auto start a session when Zsh is launched in a SSH connection. # zstyle ':prezto:module:tmux:auto-start' remote 'yes' + +# Integrate with iTerm2. +# zstyle ':prezto:module:tmux:iterm' integrate 'yes'