Awesome Tmux
github.com
github.com
tmux new -s session_name
creates a new tmux session named session_name
tmux attach -t session_name
attaches to an existing tmux session named session_name
tmux switch -t session_name
switches to an existing session named session_name
tmux list-sessions
lists existing tmux sessions
tmux detach (prefix + d)
detach the currently attached session
The -s/-t feel like they should not be required. They shouldn't even be different in the first place. list-sessions should just be list, since the -sessions is implicit in all other commands as well. Exiting from a session (ctrl+b d) is another new thing too. If that were at least like vim (which is terrible as well, but esc :q), it would be much easier to interact with. Only after reading the man pages these make sense.How would you do "esc :q" if you were using vim inside tmux? :)
I'm afraid I don't understand your point. What is the issue with detach? You want an non controlled escape key press to be your command trigger? How does that make any sense?
It wouldn't be terribly hard to write a wrapper for the command itself that works the way you want it to. As simple as it seems, I think that would probably be something useful to create and release.
tmux's defaults are pretty much universally thought of as awful. Change ctrl-b fo ctrl-a and find some plugins that you like. Also, consider swapping Ctrl and capslock!
My conf: https://github.com/red-bin/dotfiles/blob/master/tmux.conf
Screen also has some much better defaults.
I don't know why you would say -s shouldn't be required. Are you suggesting that "tmux new -sname command" should be something like "tmux new -ccommand name" instead?
The intent of -t is that it works much the same for all commands.
Of course you need to read the manual for anything more than the very basics, but tmux is hardly unique in that. Vim is hardly intuitive in any way.
ssh -> tmux -> start something -> ctrl-b d -> logout
and maybe later:
ssh -> tmux a
to check the status.
I found it quite handy, then I discovered Emacs :-) We could stay on the subject for years I reckon.
tms () {
session_name="${1:-sean}"
tmux new-session -A -s "${session_name}"
}
What that does is create a new session or attach to one if it exists. This makes it really easy to detach a session or to log into the same session in multiple windows or whatever.I can pass a name for the session but if I don't it defaults to my name (so when I'm on a multi-user box my session doesn't clash with other people's). This makes it easy to have separate "work" and "personal" sessions or whatever.
I think for "tmux new-session -A" to work you need a reasonably recent tmux but anything from the last couple of years or so should work.
Sometime I mangle the status line after a copy/paste operation but I haven't investigated why it happens, my only gripe is that I always forget to press Shift before using the mouse when selecting text.
TMUX is awesome!
Give it a try. You'll be glad you did.