9 comments

[ 3.5 ms ] story [ 32.8 ms ] thread
Honestly I think tmux session managers are great, but I usually end up not using them. I want something simple that just works. Give me built in defaults that make sense and maybe a way for users to contribute their configs to a repo with tagging, search and ratings, and I might stick with one.
My approach to tmux session management is the following

  tm() {
      if [ -z $1 ]; then
          tmux list-sessions
          return
      fi
      tmux detach -s $1 2> /dev/null
      tmux attach-session -t $1 2> /dev/null || tmux new-session -s $1
  }

  _tm() {
    local word completions
    word="$1"
    sessions=`tmux list-sessions 2> /dev/null`
    [ $? -ne 0 ] && return
    completions=`echo "$sessions" | cut -d ':' -f1`
    reply=( "${(f)completions}" )
  }
  compctl -K _tm tm
I don't find I need to persist sessions, I just want a quick way to switch between them. This gives me a tm command that autocompletes session names and creates new sessions if they don't exist. It also detaches existing clients since I only ever connect once and this way I don't have to deal with issues of differing terminal sizes.
I have used tmux and vim daily for a few years now and haven't a clue about what's being demonstrated in the linked animation.

They seem to load tmux, then some files in vim, then change panes.

I'm the same. I use tmux generally in one window, and may have several sessions within that but I do not do any kind of complex split-screen layouts etc. I find that just starts demanding too much mental attention aside from from the task I'm really trying to do.

For layout of multiple terminal sessions I use a tiling window manager on my desktop.

I was in the same boat.

I've used tiling WM's full time for maybe the past decade (xmonad, i3, awesome, dwm, scrotwm/spectrwm). Also I use rxvt-unicode with the tabs extension. That's in addition to tmux.

In practice, I do not perceive redundancy. Using the tiling WM to keep the layout of terminals doesn't persist across login/logout or even the X session. Also, you can SSH to the box via another machine and have the layout there waiting for you.

Another factor that played a roll in it probably was irssi / weechat and ssh'ing into a remote box for it. No special splits or anything crazy, just using the attach/detach feature. I started with screen. Eventually moved to tmux (one thing I missed from screen was easily being able to share the 'session', though I forgot screen's terminology for that).

Then for a time, I saw tmuxinator and teamocil out there, but felt meh, don't feel like keeping a bunch of config files floating around. This was before it came a trend to store dot-configs in git.

When I realized I could have a dot config persisted across my machines (local network and remote) via git, that's when keeping project files became less an abstract nicety and more of a time saver.

I see many gradually evolve into trying a session manager out, but also see many (like another commenter ITT) who get by fine with a simple script.

I'm using https://github.com/tmuxinator/tmuxinator for quite some time and find it very convenient. Are there any advantages of Tmuxp?
I haven't used teamocil or tmuxinator in a few years. At the time, both had a few itches to scratch. i was surprised to see how well thought-out and scriptable tmux was. the often overlooked formats [1] and targets [2] options in the tmux manual had a lot of possibilities to do precise tweaks across sessions, windows and panes, but they were cumbersome to articulate. it seemed like a superb candidate to create an object mapper for in python. In recent months, I spun off the low-level python library for mapping sessions, windows and panes to objects to libtmux [3]

I will give a try at advantages, but take note its been a while and tmuxinator may have improved on these:

1. focusing a pane in each window, as well as window in the session. So after the session is loaded, the cursor will be focused wherever you entered "focus: true". http://tmuxp.readthedocs.io/en/latest/examples.html#focusing. tmuxinator's startup_window seems to only do window focusing, not pane focusing.

2. freezing tmux layouts http://tmuxp.readthedocs.io/en/latest/cli.html#freeze-sessio...

3. JSON support

4. More ability to resolve paths relative to configuration file and relative to start_directory. http://tmuxp.readthedocs.io/en/latest/examples.html#start-di...

5. before_script for bootstrapping project dependencies before launch http://tmuxp.readthedocs.io/en/latest/examples.html#bootstra.... Can target bootstrap script via absolute path, relation to start_directory and relation to config directory.

6. Set custom indexes (window numbers) via config

These are little conveniences I don't recall seeing in tmuxinator/teamocil in 2013 (I originally used both):

- If your tmux session is already loaded, it will offer to attach it for you instead of re-running. (I don't recall if this was tmuxinator or teamocil)

- If you're already inside a tmux session and load a session via tmuxp, it will offer to switch-client for you.

- There is also an ability to import teamocil and tmuxinator configs, http://tmuxp.readthedocs.io/en/latest/cli.html#import, though it may be out of date with the latest config for them. I'm considering whether I want to remove the feature, or just try to load them natively. It wouldn't be hard.

[1] http://www.freebsd.org/cgi/man.cgi?query=tmux&apropos=0&sekt... [2] http://www.freebsd.org/cgi/man.cgi?query=tmux&apropos=0&sekt... [3] https://github.com/tony/libtmux

They missed an opportunity to make a completely oblique literary reference by not calling it 'ptmux' (for the Pratchett fans in the audience).
How does this compare against byobu?