30

^b+page up/down scrolls up/down one page of scroll buffer, but how do we scroll to beginning ?

like wise with end (besides pressing ^C to kill scrolling)

1
  • 8
    why the downvote? this question is hard to find an answer to (every related question only asks about page up/down) Commented Jun 24, 2015 at 20:27

2 Answers 2

26

This depends on the binding of "mode-keys". If you have set-option -g mode-keys emacs in your ~/.tmux.conf file (actually, this should be the default), then you can go to the beginning and the end of the buffer using corresponding emacs keys:

  1. Enter the copy mode using: ctrl-b + [
  2. Go to the beginning using: Alt + shift + , (or, in emacs' notation: M-<)

Similarly, going to the end is achieved by M->

If instead you prefer vi keybindings, you can put set-option -g mode-keys vi in your ~/.tmux.conf file, and then you have:

  1. Enter the copy mode using: ctrl-b + [
  2. Go to the beginning using gg, go to the bottom using G

Please note that configuration in ~/.tmux.conf only takes effect after the tmux server restarts. That is when you kill all sessions and then restart tmux.

Sign up to request clarification or add additional context in comments.

4 Comments

This works on 1 laptop (mac) but not on another mac. I did also add 'set-option -g mode-keys emacs' in ~/.tmux.conf just to make sure. How would i change key binding to 'h' instead of Alt+shift+, (just to try if that works) ?
You can change copy-mode key bindings with the -t parameter to bind-key. For instance, bind-key -t vi-copy Home history-top and bind-key -t vi-copy End history-bottom (or emacs-copy if you use emacs mode) make it easy to get to the top and bottom of history.
seems to default to vi mode... so gg for top G for bottom
@JonnyRaa that also only scrolls back to the end of the buffer (for G) btw in case anyone wondering how to just jump back to the dang input. The easiest method if that's what you're looking for (which I was) is to just press q, which exits scroll mode and puts you back to the terminal input (without killing off mouse mode)
1

You can use like:

bind-key -T copy-mode C-S-Home send -X history-top # Ctrl+Shift+Home
bind-key -T copy-mode C-S-End send -X history-bottom # Ctrl+Shift+End

This way when you are in copy mode Ctrl+Shift+Home will take you to the beginning of scroll buffer and Ctrl+Shift+End will take you to the end of scroll buffer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.