Hacker News new | past | comments | ask | show | jobs | submit login

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.


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


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...


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 <lines>'. 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?


>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.

Perhaps try iTerm2 (for Mac) native tmux integration. You can have tmux panes and split panes that are (and behave like) regular terminal panes and tabs.


That program is so disgustingly good it was almost the sole reason I bought this generations macbook pro.

If any terminal emulator programmers are listening cough konsolecough please consider following the same method of integration <3


"You can have tmux panes and split panes that are (and behave like) regular terminal panes and tabs."

What's the advantage of that exactly?


Proper fucking scrolling?

Less terminal behavior that needs to be multiplexed by tmux?

More integration with other iTerm features (instead of tmux panes being agnostic to them)?


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?


I haven't used it, but there's a plugin which allows for this behavior: https://github.com/tmux-plugins/tmux-resurrect


The session doesn't actually persist between boots. I think what the parent must be referring to is the ability to create tmux session configurations. Then after a reboot if you try to connect to the session which no longer exists the conf will spin it up for you.


Gotcha. I'll have to look up some docs on that, sounds useful.


Yeah, I use https://github.com/tmux-plugins/tmux-continuum to auto save sessions, and https://github.com/tmux-plugins/tmux-resurrect to restore them when tmux is started.


I disable my Terminal.app buffer. If not in tmux, can't scroll back. All scrolling and copy and pasting is done with tmux. Also use vi keybindings so I select text and copy using same keys in vim and tmux.


That is absolutely not 'better', sorry. Taking your hands off the keyboard to do something basic is never better.


I disagree. I want to select with the mouse and touch type with the keyboard.

And "doing it faster" is never a concern. As a programmer I write about 5% of what I could type in the same time as a secretary or accountant. Most of the work is thinking.

Plus, the occasional chance to get your hands off of the rigid (and carpal tunnel inducing) pose on the keyboard and move them to the mouse, or vice versa, is welcome.

I don't want to replicate things the mouse does better with keyboard shortcuts, or suffer "modal" input-modes in my programs.


k

I still prefer not using the mouse for a basic operation like scrolling, thank you.


I myself prefer to scroll with the keyboard in tmux, but for moving the cursor and selecting text, tmux has a very, very long way to go before being optimally efficient and useful in this regard.

The kings of keyboard-based cursor movement and text selection are vim and emacs, both of which have a very rich and powerful toolbox of techniques and plugins that help the user do that quickly and efficiently.

For example, emacs has plugins like ace-jump-mode which lets you jump the cursor to any precise position on the screen by typing just one or two keystrokes. vim has similar plugins, like easy-motion and precisejump.

vim and emacs also have quick ways to select words, sentences, paragraphs, functions, lines, logical and visual blocks, the entire document, etc. This includes having full access to rich and powerful regex text matching, which can be used for selection.

In contrast to emacs and vim, when I try to move my cursor and select text in tmux, I feel crippled. So sometimes I do succumb to the temptation of using the mouse to select text in tmux, despite being quite comfortable and satisfied in using the keyboard exclusively in vim and emacs.


I can still navigate the scrollback in tmux with my keyboard, I just prefer not to.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: