Practical Tmux
mutelight.org
mutelight.org
Granted, tmux has a better configuration language.
However the whole session/window/pane/instance model is bizarre, as evidenced by the secition "Multiple Clients Sharing One Session" under "common problems" in the linked article.
On top of that, the below are all given as points in favor of tmux, but they're either arguably better in screen or else a wash:
> Better redraw model
This is one of the (many) things that drove me back to screen. The two times I tried tmux, it had exactly this kind of issue where it would fail to redraw the screen correctly after SIGWINCH.
> screen contents persisted through full-screen programs
doesn't this depend on whether the program calls curses endwin() function ? why does tmux/screen need to know about this ?
> not possible to remove the visual bell from Screen completely
doesn't this work?
vbell off
bell_msg ""
though I'm not sure why you would want to do such a thing.> automatic window renaming
last I checked this used a huge amount of cpu. is that no longer the case ? in any case, I name my windows according to what i'm doing in that window, since "bash" or "screen" (I use nested screen sessions) or "emacs" is not a useful window title.
> vertical splits
newish screen does this. I don't see the use. I figure I either have a roughly 80-column screen (default linux virtual terminals) or it's wide enough to have multiple 80-column windows (laptop or desktop running X). If I have enough horizontal space, I'm using a sensible window manager that is better-suited to real estate management.
Also how does tmux handle copy/paste with vertical splits ?
> vi key bindings in copy mode
is this supposed to be a win for tmux over screen ? both basic emacs and vi movement works out of the box in screen.
Many of the purported benefits - better configuration language, more maintainable code - don't matter to me:
- Screen is done and isn't going to change. Debian has had the vertical splits patch for so long I was surprised it was a patch.
- My configuration of screen is not going to change. It's five lines that I copied and pasted 10 years ago. There's just not that much that needs to be configured.
The "Multiple Clients Sharing One Session" thing is important to me and screen gets it right by default. It's useful to have a few fixed xterms on my screen and a bunch of multiplexed terminals in screen. I use one screen session per task.
I think "screen contents persisted through full-screen programs" is screen's "altscreen on" setting. Or at least that's my note from the person whose screenrc I stole.
It doesn't. If I want to copy some text and it's in a vertical split, well... shit. Time to break out the tmux manual and see if I can figure out how to move this pane above the other one. You know what, screw it. I'll just open a new window entirely, and re-run the test there so I can copy the output.
That's how tmux handles copy/paste with vertical splits.
You mean selecting text with a mouse on a vertical split? If so get tmux upgraded to 1.8+ then prefix-z and you can temporarily zoom the window to full screen.
Your information on tmux is highly out of date.
Also prefix-alt-2 will move to horizontal layout of panes.
Thanks!
Or do the rotation thing. Or do the copy-mode thing. More than one way to skin this cat; just depends on which workflow you wish to adopt.
I too generally use tmux's built-in text-selection and clipboard when I'm copying from pane to pane, because it's more convenient.
C-b M-1 to rotate the panes back into a vertical split.
The session/window/pane/instance thing is definitely confusing and not well explained. I think it's even worse if you already have a lot of screen experience.
screen has the equivalent to sessions as well `screen -ls` will show them whereas `tmux list-sessions` will show the tmux ones. A window is composed of panes (analogy from physical windows, pane of glass). An instance is one user on a session.
Can you name one distro that doesn't include it by default? In my experience you can rely on just about every system having a core set of utilities: bash, vim, screen, ssh etc.
But if you have your own workstation and do most of the work with this workstation, tmux + customized configs might be a viable option. It just depends how good your muscle memory will keep up. :)
> doesn't this depend on whether the program calls curses endwin() function ? why does tmux/screen need to know about this ?
I just tested out of curiosity. Running vim and exiting in tmux reverts to the previous screen contents, like in raw urxvt; in screen, the previous screen contents are lost. I do not know why.
This drove me nuts until I found block select. (Option-Command drag in OSX). That pretty much eliminated that problem for me.
The setting in ~/.screenrc that the article is missing is called "altscreen on".
Also, tmuxp is python instead of ruby, and it gives you an API to interact from your python code with tmux.
a) A single keyboard shortcut to navigate between both panes and vim windows in a single tmux workspace: http://www.reddit.com/r/vim/comments/22ixkq/navigate_around_...
b) Send a region from vim to a tmux/screen window: https://github.com/jpalardy/vim-slime
The combination of these gives me a nice environment for lisp hacking without needing to switch to emacs.
Oh man you got my hopes up. This would be lifechanging if my tmux session was running on the same machine that vim was running. "#{pane_current_command}" is almost always ssh for me.
I really wish I could get this for tmux + i3wm. I haven't really looked for a way to achieve it yet, though.
I'm using ctrl+hjkl to navigate tmux and vim panes, and winkey+hjkl to navigate i3wm windows.
bind c neww -c '#{pane_current_path}' unbind '%'
bind '_' split-window -c "#{pane_current_path}"
bind '"' split-window -h -c "#{pane_current_path}“
Here, I am using <C-B>“ or <C-B>_ for a vertical and horizontal splits.If anyone is interested in the settings I've accumulated over the months, here is my config file: https://github.com/ludwig/dotfiles/blob/master/tmux.conf
I started using tmux about 2 years ago and don't know how I lived without it.
set -o vi
in your bashrc.The lines indicate the splitting direction, and I do not have to move my fingers around that much to reach, e.g <C-B>%
The two arguments I could see are resource usage (not an issue on modern machines) or detach/attach (which is a huge benefit when working remotely, but I don't see any gain locally). But other than those, I don't see any benefits to having a second tiling system sitting on top of my current tiling system.
(For reference, I use i3.)
And per project, I'll have a few. Say I have one where I have one shell for compilation, one for version control, and two for testing. Give each one a prefix for the project, and I've got all that separated out. E.g.: Two projects: foo and bar: foo-compile, foo-git, foo-test-a, foo-test-b, bar-compile, bar-git, etc..
Now, I have clean shell histories (and scroll buffers) for each. I can ssh into each one as I want, and reuse my terminal windows. This latter bit helps keep my already-complex-enough window setup manageable.
2. You work on a remote machine and prefer to have your window layout remembered there, so it can instantly be restored no matter what computer you're physically working on, whether or not it happens to have or even support your favorite tiling window manager.
3. It's simply easier for me to do everything within one terminal window full-screened on a 27 inch monitor. It's less context switching.
For 3, can you elaborate? How is it less context switching? You're doing the same set of operations in both settings - switching, moving and resizing terminal windows (whether real or virtual).
Abduco is a dtach replacement by dvtm's author. From http://www.brain-dump.org/projects/abduco/ :
"abduco is in many ways very similar to dtach but is actively maintained, contains no legacy code, provides a few additional features, has a cleaner, more robust implementation and is licensed under a BSD style license"
No the screen is cleared after quitting.
I have TERM set to xterm-256colors FWIW.