How do you manage/organize sessions/projects with tmux workflow?

I been using tmuxinator for a quite long time now, thinking to try something new.
Any recommendations?

Thanks in advance.

I personally don’t use any libraries for tmux. I usually stick to a tmux session pre project / git repo I am working on. Within each session, the first window usually has Vim and a pane for running tests. I’ll run servers and other support processes in a second window. I tend to find that the specific window & pane configuration I need changes enough that it is not worth automating.

One helper I do use is a little bash script, tn, which will start a new session named for the current directory.

tn() {
  if [ -z "$1" ]; then;
    session_name=$(basename `pwd`)
  else
    session_name=$1
  fi
  tmux new-session -s $session_name
}

I also make heavy use of the navigation key bindings summarized in our blog post, Seamlessly Navigate Vim and tmux Splits.

Lastly, I find myself jumping between sessions with the choose-session command which I bind to <prefix>C-j

Is there something specific you find lacking in tmuxinator or would like to add to your setup?

Is there something specific you find lacking in tmuxinator or would like to add to your setup?

That is the great tool, however currently I’m also finding it a little bit overkill, it still useful for some complex/specific projects setups, but for now it looks like tn() is all I need in most cases :smiley:

Thank you!

I’ve been using the tat script for a couple months and I really like everything about it except the fact that when i’m in a session and want to start another session i find myself cd’ing into the other project and running tat which leaves my previous sesisson with one of the panes cd’d to the new projects dir. does this make sense? do you do something different in the workflow?

@w1zeman1p, there’s a nice trick from @christoomey’s configuration that does this:

# "break session" and "kill session"
bind-key C-b send-keys 'tat && exit' 'C-m'

So the way this works is you split a pane, cd to the folder you want to do a new session in, and then hit <prefix><C-b>, and the new tmux session opens as if you typed tat, but the pane you used to launch the new session is cleaned up.

I find without this trick that my tmux sessions get terribly messy as I jump around.

Nice! Thanks @geoffharcourt this is exactly what i was looking for! :slight_smile:

1 Like

I do it through detach-client:

  1. detach-client <prefix>d
  2. cd into the other project
  3. tn (or tat myproject in your case)
1 Like