From 41da75ad3948d6710241a46ec07457e4b2e3ae5c Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 1 Dec 2014 21:01:58 +0000 Subject: [PATCH] Add support for iTerm2's Tmux integration This should resolve #52. --- README.md | 16 ++++++++++++++++ lib/layout-helpers.sh | 3 ++- libexec/tmuxifier-load-session | 6 +++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0599fc7..a71d30a 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,22 @@ any reason you need to disable it, just set `$TMUXIFIER_NO_COMPLETE`. export TMUXIFIER_NO_COMPLETE=1 ``` +## Tips + +### iTerm2 Integration + +Tmuxifier supports iTerm2's [Tmux integration][]. It can be used in two ways: + +- Passing `-CC` as a second argument to the `load-session` command. For +example: + + tmuxifier load-session my-awesome-session -CC + +- Setting the `TMUXIFIER_TMUX_ITERM_ATTACH` environment variable to `-CC` + before calling the `load-session` command. + +[tmux integration]: https://code.google.com/p/iterm2/wiki/TmuxIntegration + ## Inspiration - Tmuxifier is largely inspired by [Tmuxinator][]. diff --git a/lib/layout-helpers.sh b/lib/layout-helpers.sh index dbbcb9a..7daec41 100644 --- a/lib/layout-helpers.sh +++ b/lib/layout-helpers.sh @@ -323,7 +323,8 @@ __get_current_window_index() { __go_to_session() { if [ -z "$TMUX" ]; then - tmuxifier-tmux -u attach-session -t "$session:" + tmuxifier-tmux $TMUXIFIER_TMUX_ITERM_ATTACH -u \ + attach-session -t "$session:" else tmuxifier-tmux -u switch-client -t "$session:" fi diff --git a/libexec/tmuxifier-load-session b/libexec/tmuxifier-load-session index 927a141..85f9e70 100755 --- a/libexec/tmuxifier-load-session +++ b/libexec/tmuxifier-load-session @@ -7,7 +7,7 @@ source "$TMUXIFIER/lib/util.sh" # Provide tmuxifier help if calling-help "$@"; then - echo "usage: tmuxifier load-session + echo "usage: tmuxifier load-session [] Aliases: session, ses, s @@ -30,5 +30,9 @@ fi # Load runtime functions. source "$TMUXIFIER/lib/runtime.sh" +if [ "$2" == "-CC" ]; then + export TMUXIFIER_TMUX_ITERM_ATTACH="-CC" +fi + # Load session file. load_session "$1"