Live data from Hacker News

Using tmux properly

danielallendeutsch.com

21–30 of 218 posts

Re: Using tmux properly

#21
post #3

There is one thing I want from my terminal multiplexer: working scroll functionality with Shift+PgUp/PgDn, even in split screens, just like in a plain console, without messing everything up. Is that possible?

Kind of. I use bind-key -t vi-copy "J" page-down bind-key -t vi-copy "K" page-up Then I can just enter tmux's vi mode, and scroll up and down with shift-J/K. I don't know of a way to bind shift-PgUp/PgDn though, which sounds like what you are looking for.

Even if you can bind it to the right keys, you still have to exit this special mode afterwards. That's less than optimal.

Re: Using tmux properly

#22
post #3

There is one thing I want from my terminal multiplexer: working scroll functionality with Shift+PgUp/PgDn, even in split screens, just like in a plain console, without messing everything up. Is that possible?

You do one better - tmux's mouse mode allows you to scroll with your mouse wheel. Just add 'set -g mouse on' to your ~/.tmux.conf. You can configure the history size limit by setting 'set-option -g history-limit '. When you scroll the mouse wheel, tmux will enter copy mode and scroll.

The problem is, my terminal already has a concept of scrolling, and its own concept of a buffer, with its own concept of keeping unlimited contents based on available memory, etc.

I've never seen a tmux setup that doesn't fail horribly when these two concepts collide (I can't cmd-f search the buffer for interesting things, I don't get a scroll bar on the right that shows me how far up the buffer I am, scroll acceleration doesn't work, etc.)

Terminal.app already does split panes, tabs, scroll acceleration, search, etc. I don't get persistence, but I don't really understand the workflow where you'd want it. I typically open new tabs exactly because I want a fresh workspace, and I close them exactly because I want to clear my workspace. I can just manually call tmux when I know the thing I'm running should outlast a window (and actually, 99% of the time that's on a server I'm SSH'd into, not on my local machine.)

Can anyone convince me why I need to be all-tmux all-the-time?

Re: Using tmux properly

#23
post #6
post #3

There is one thing I want from my terminal multiplexer: working scroll functionality with Shift+PgUp/PgDn, even in split screens, just like in a plain console, without messing everything up. Is that possible?

Byobu does this in my case with default settings, just with alt+pg-up/down

Hey, I just tried that and it's pretty close to what I want. Thank you.

edit: close, but no cigar. It enters "scrollback mode", which you have to exit before you can type again. It's just like screen's copy mode with different key bindings.

Re: Using tmux properly

#24
post #21

Earlier quoted context omitted.

Kind of. I use bind-key -t vi-copy "J" page-down bind-key -t vi-copy "K" page-up Then I can just enter tmux's vi mode, and scroll up and down with shift-J/K. I don't know of a way to bind shift-PgUp/PgDn though, which sounds like what you are looking for.

Even if you can bind it to the right keys, you still have to exit this special mode afterwards. That's less than optimal.

Agreed, though I don't personally find it annoying. I guess I'm too used to using vim that it doesn't bother me.

Re: Using tmux properly

#25

Earlier quoted context omitted.

You do one better - tmux's mouse mode allows you to scroll with your mouse wheel. Just add 'set -g mouse on' to your ~/.tmux.conf. You can configure the history size limit by setting 'set-option -g history-limit '. When you scroll the mouse wheel, tmux will enter copy mode and scroll.

The problem is, my terminal already has a concept of scrolling, and its own concept of a buffer, with its own concept of keeping unlimited contents based on available memory, etc. I've never seen a tmux setup that doesn't fail horribly when these two concepts collide (I can't cmd-f search the buffer for interesting things, I don't get a scroll bar on the right that shows me how far up the buffer I am, scroll accelera…

Sessions are the killer feature for me. I have a session for each project I work on and can have all my tabs, panes, vim, etc set up and switch between them at any time. Sessions can be persisted so that even if I reboot my machine all my project workspace configurations are saved and ready to go.

Re: Using tmux properly

#26
post #3

There is one thing I want from my terminal multiplexer: working scroll functionality with Shift+PgUp/PgDn, even in split screens, just like in a plain console, without messing everything up. Is that possible?

I wrote my own terminal emulator and screen-like program to get there... I made mine send the code for shift+pageup/down when the application is in alternative screen mode, so I could forward the keypress all the way down to the server...

Re: Using tmux properly

#27
post #25

Earlier quoted context omitted.

The problem is, my terminal already has a concept of scrolling, and its own concept of a buffer, with its own concept of keeping unlimited contents based on available memory, etc. I've never seen a tmux setup that doesn't fail horribly when these two concepts collide (I can't cmd-f search the buffer for interesting things, I don't get a scroll bar on the right that shows me how far up the buffer I am, scroll accelera…

Sessions are the killer feature for me. I have a session for each project I work on and can have all my tabs, panes, vim, etc set up and switch between them at any time. Sessions can be persisted so that even if I reboot my machine all my project workspace configurations are saved and ready to go.

How do you persist sessions between reboots?

Re: Using tmux properly

#28
post #19

Earlier quoted context omitted.

Does it absolutely have to be a combination of Shift and PgUp/PgDn? With tmux, you can type your prefix key followed by PgUp and it will scroll up, even in split screens. For example, if your prefix key is Control-b, you would type Control-b PgUp and get the effect you want.

I'd like to use the same key combination, no matter if I'm in screen/tmux or not.

the bind -n command allow to bind keys without the prefix. For example, I use the following to resize panes without using the prefix :

  bind -n M-h resize-pane -L 5
  bind -n M-j resize-pane -D 5
  bind -n M-k resize-pane -U 5
  bind -n M-l resize-pane -R 5
Post reply on HN