Live data from Hacker News

A Tmux Crash Course (2011)

robots.thoughtbot.com

61–70 of 85 posts

Re: A Tmux Crash Course (2011)

#62
post #45

I like being able to shift+pageup in consoles to see history, but haven't got a good replacement for this in tmux. (Including when you switch to a new window and want to see something.) Usually I go into copy mode and scroll up. This works. But maybe there's a better way. Anyone know?

I found this http://superuser.com/questions/209437/how-do-i-scroll-in-tmu... (take a look at second answer). But it has its drawbacks like not respecting panes etc... After some time I had this in my config I found myself using copy mode anyway.

Re: A Tmux Crash Course (2011)

#64

I am curious to know what are the major differences between tmux and a tiling window manager? I've used awesome Wm for a while, now on i3wm.

I can answer tangentially as a screen user for a couple decades that if you put something like

if [ -n "$SSH_TTY" }; then exec /usr/bin/screen -xRR fi

in your .bash_profile then where ever in the world you log in via ssh, you'll instantly have exactly the same environment, as if you never disconnected. Simply "Ctrl-a z" to disconnect and later reconnect "somewhere else" exactly as if you hadn't disconnected.

You can do something kind of like that with a tiling window manager if you put VNC in between the user and the window manager, such that all access is via VNC. However VNC doesn't transparently remap like screen does, so you can get icky issues with mismatched screen resolutions in VNC. In that way screen/tmux is MUCH better than doing something kinda like it with VNC. OR rdesktop, or whatever.

In .screenrc I'd suggest startup_message off, vbell off (because I don't like it), and some lines similar to bindkey -k k1 select 1, bindkey -k k2 select 2, so that function keys insta-switch you. Also I have a "caption always" line that resembles line noise but it begins with the hostname and shows exactly which sessions I've opened and highlights the one I'm looking at right now. I probably last messed with it 15 years ago so I don't remember how it works.

You can put lines in .screenrc like "screen -t bash 0" to autorun a bash shell in screen 0. You could put something like "watch procinfo" in screen 0, or tail something, or whatever.

For all intents and purposes screen overlaps tmux about 99.99%. There is a small 0.01% area where featuresets and bugs do not overlap. There's a cultural thing where "most" screen users know about screen and tmux, and "most" tmux users don't know about screen, which is mildly interesting.

Re: A Tmux Crash Course (2011)

#65

I use Terminator ( http://www.tenshu.net/p/terminator.html ) primarily on local machines instead of screen/tmux(or byobu). I get the added benefit of scrolling. I tend to copy paste a lot from log tails etc into my my text editor for quick searches or other things. The infinite scroll feature(with a scroll bar) helps me out a lot. In tmux/screen i still haven't figured out a good workflow to copy a few screenful of c…

Have you tried tmux's mouse modes? You can use the mouse wheel to scroll and highlight to copy. I think you are specifically trying to say the mouse highlight won't go past one window though, right? You can also resize panels and select widows.

I knew I saw a way to interact with it through the mouse. Thank you for reminding me. `tmux` is really a neatly little program, everything is there, simple and efficient.

ps:

    man tmux | grep "mouse-" # shows the mouse related options
    C-b : "set mouse- on"
pps: turning on mouse windows/panels interactions disable text selection, do you know a way to have both ? (beside switching beside custom defined modes on your .conf)

Re: A Tmux Crash Course (2011)

#66
post #40

I know everyone remaps their prefix to ctrl-a - how do you then jump to the start of a line? Edit: Thanks for the solutions. Will have a play. Like the sound of using ctrl-\

You map a to send the prefix: bind-key a send-prefix Now when you type ctrl-a gets sent.

A while ago I changed my prefix to ctrl-q because of ctrl-a interfering with me being able to move to the beginning of a line. Not sure if I would go back to ctrl-a now, but this is nice to know.

Re: A Tmux Crash Course (2011)

#67
post #37
post #5

Earlier quoted context omitted.

If you have mouse integration off, selecting text in the terminal copies it to the system clipboard. As simple as click+drag to select.

How about copying text isolated in a pane to the system clipboard? For example if I have a split vertical pane, it will copy text from both panes.

If you don't mind trailing whitespace block select might be an option (option + select on OS X / ctrl + alt + select on Linux). Or just use copy mode and yank the selection to the system clipboard.

Re: A Tmux Crash Course (2011)

#68
post #31
post #7

If you're willing to spend $14 for a more detailed tutorial, I'd strongly recommend _ tmux: Productive Mouse-Free Development_ from The Pragmatic Bookshelf. It goes through common use cases, common customizations, and pair programming. http://pragprog.com/book/bhtmux/tmux

I do not get the idea of buying a "book" to learn a *nix utility that explains itself in a single man page when all you need to learn is just a few keyboard shortcuts. Obsessively focusing on the tool does not magically improve productivity.

I know! It's really bizarre. It's almost like some people have different preferences from you or something. Let's spend more time talking about how people with different preferences are weird and stupid.

Re: A Tmux Crash Course (2011)

#69
Terminal multiplexers are great if you're stuck in SSH, working without a window manager at all, or have a real need to share a set of terminals with multiple people at once.

But if you're hacking together a desktop environment with tiled terminals, status bars, keyboard shortcuts, dynamic or static layouts, and the ability conceal layouts on different workspaces (which is what most people's intent is when using detachment), then just get a tiling window manager already.

You're reinventing the wheel.

Post reply on HN