Scroll shell output with mouse in tmux Announcing the arrival of Valued Associate #679: Cesar...

Philosophers who were composers?

How to compute a Jacobian using polar coordinates?

What's parked in Mil Moscow helicopter plant?

How do I deal with an erroneously large refund?

Writing a T-SQL stored procedure to receive 4 numbers and insert them into a table

What is the definining line between a helicopter and a drone a person can ride in?

What is /etc/mtab in Linux?

How was Lagrange appointed professor of mathematics so early?

Is there a verb for listening stealthily?

/bin/ls sorts differently than just ls

Will I lose my paid in full property

Suing a Police Officer Instead of the Police Department

How would you suggest I follow up with coworkers about our deadline that's today?

How would it unbalance gameplay to rule that Weapon Master allows for picking a fighting style?

Is there a possibility to generate a list dynamically in Latex?

What were wait-states, and why was it only an issue for PCs?

France's Public Holidays' Puzzle

Married in secret, can marital status in passport be changed at a later date?

Could a cockatrice have parasitic embryos?

Test if all elements of a Foldable are the same

"Working on a knee"

Why does Java have support for time zone offsets with seconds precision?

Israeli soda type drink

What is a 'Key' in computer science?



Scroll shell output with mouse in tmux



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)How do I scroll in tmux?What does Terminal app's “Show Alternate Screen” do? (OS X)Using tmux - scrolling via sshtmux - How to NOT automatically exit copy mode when scrolling down?Scroll with mouse in tmux without mouse highlighting controlled by tmuxConky starts above windows in Ubuntu Mavericktmux mouse select and scroll at the same time?Enabling mouse in tmux conflicts with paste in XScroll with mouse in tmux without mouse highlighting controlled by tmuxPass mouse events through tmuxline wrapping breaks intermittently (R, tmux, readline)tmux GUI-based scrollingTmux Mouse scroll brokenScroll multiple lines with mouse in tmuxWhat does the Byobu / tmux copy mode do and how can I customize it?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







241















Mouse scrolling doesn't work in tmux the way it works when I run shell without tmux (in Gnome Terminal). It seems tmux sends mouse scroll events as if I pressed Up/Down keys. But I want it to scroll though the shell output history. Is there a way to make tmux work like this?



Note: I know how to scroll with the keyboard (thanks to another question here).



I tried mouse scrolling in two versions of tmux:




  • 0.8-5hardy1 (on Ubuntu 8.04 (Hardy Heron))

  • 1.3-1 (on Ubuntu 10.10 (Maverick Meerkat))










share|improve this question




















  • 1





    I think bukzor's answer solves your problem for tmux 1.5 and newer.

    – kynan
    Dec 9 '11 at 13:31


















241















Mouse scrolling doesn't work in tmux the way it works when I run shell without tmux (in Gnome Terminal). It seems tmux sends mouse scroll events as if I pressed Up/Down keys. But I want it to scroll though the shell output history. Is there a way to make tmux work like this?



Note: I know how to scroll with the keyboard (thanks to another question here).



I tried mouse scrolling in two versions of tmux:




  • 0.8-5hardy1 (on Ubuntu 8.04 (Hardy Heron))

  • 1.3-1 (on Ubuntu 10.10 (Maverick Meerkat))










share|improve this question




















  • 1





    I think bukzor's answer solves your problem for tmux 1.5 and newer.

    – kynan
    Dec 9 '11 at 13:31














241












241








241


92






Mouse scrolling doesn't work in tmux the way it works when I run shell without tmux (in Gnome Terminal). It seems tmux sends mouse scroll events as if I pressed Up/Down keys. But I want it to scroll though the shell output history. Is there a way to make tmux work like this?



Note: I know how to scroll with the keyboard (thanks to another question here).



I tried mouse scrolling in two versions of tmux:




  • 0.8-5hardy1 (on Ubuntu 8.04 (Hardy Heron))

  • 1.3-1 (on Ubuntu 10.10 (Maverick Meerkat))










share|improve this question
















Mouse scrolling doesn't work in tmux the way it works when I run shell without tmux (in Gnome Terminal). It seems tmux sends mouse scroll events as if I pressed Up/Down keys. But I want it to scroll though the shell output history. Is there a way to make tmux work like this?



Note: I know how to scroll with the keyboard (thanks to another question here).



I tried mouse scrolling in two versions of tmux:




  • 0.8-5hardy1 (on Ubuntu 8.04 (Hardy Heron))

  • 1.3-1 (on Ubuntu 10.10 (Maverick Meerkat))







shell tmux






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 20 '17 at 10:04









Community

1




1










asked Nov 12 '10 at 14:02









user31494user31494

1,313296




1,313296








  • 1





    I think bukzor's answer solves your problem for tmux 1.5 and newer.

    – kynan
    Dec 9 '11 at 13:31














  • 1





    I think bukzor's answer solves your problem for tmux 1.5 and newer.

    – kynan
    Dec 9 '11 at 13:31








1




1





I think bukzor's answer solves your problem for tmux 1.5 and newer.

– kynan
Dec 9 '11 at 13:31





I think bukzor's answer solves your problem for tmux 1.5 and newer.

– kynan
Dec 9 '11 at 13:31










10 Answers
10






active

oldest

votes


















227














To scroll within history of the output You would use ^b + [
You can then use M+V to page up and ^V to page down. I don't know if You can use the real PgUp and PgDown though. My terminal does not send these keys to the tmux. Instead it scrolls itself and not the tmux history.



To exit the copy mode, press ESC



To use your mouse in this mode (called copy mode) press ^b + :
and enter following:



setw -g mouse on


Note: In tmux < 2.1, the option was named mode-mouse, and not mouse



Now when You change to the copy mode you can use your mouse to scroll through it.
You can put this command in your ~/.tmux.conf if You want so it loads every time You run tmux.



Update: As of tmux 1.5 this option makes using the scroll wheel automatically switch to copy mode and scroll back the tmux scrollback buffer. It is not necessary to first hit Ctrl-B + [ any more. Scrolling back down to the prompt also ends copy mode automatically.






share|improve this answer





















  • 1





    Note that you may have to reload the config file if you already have a running tmux server. blog.sanctum.geek.nz/reloading-tmux-config tmux source-file ~/.tmux.conf

    – Allan Nienhuis
    Dec 1 '13 at 17:31






  • 7





    Not working for me on OS X.

    – Ain
    Mar 10 '15 at 13:27






  • 2





    @Ain - There are now 11 major versions of OS X. Which version are we talking about exactly?

    – Ramhound
    Jul 8 '15 at 12:24








  • 10





    For tmux >= 2.1, see @DannyRe's answer (currently quite far down).

    – joelostblom
    Dec 31 '15 at 18:07






  • 3





    set -g mouse on worked for me on macOS tmux 2.1

    – Miguel Mota
    Jan 5 '17 at 17:58





















119














There are some changes for Tmux 2.1





  • Mouse-mode has been rewritten. There's now no longer options for:




    • mouse-resize-pane

    • mouse-select-pane

    • mouse-select-window

    • mode-mouse


    Instead there is just one option: 'mouse' which turns on mouse support
    entirely.




That would be



set -g mouse on
# to enable mouse scroll, see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"





share|improve this answer





















  • 6





    Thanks, now selecting panes, etc work, but scrolling doesn't. In order to make scrolling work again, use this: github.com/NHDaly/tmux-scroll-copy-mode

    – Mahdi
    Oct 20 '15 at 20:15








  • 1





    awesome - this even works on cygwin - tmux on WINDOWS 7

    – GWD
    Jan 21 '16 at 15:52











  • @Mahdi This seems to not work on osx. Any hints?

    – DiTTiD
    Feb 11 '16 at 8:39











  • @SolidSnake: I don't remember facing any issues using that plugin. It worked smoothly, I enabled mouse mode and then installed it. You should reload your tmux config using tmux source-file ~/.tmux.conf

    – Mahdi
    Feb 11 '16 at 20:01






  • 1





    bind doesn't seem to be necessary anymore on tmux 2.3

    – Theron Luhn
    Dec 5 '16 at 18:49



















61














The current version of tmux (1.5) lets you simply set the mode-mouse option on, and allows you to scroll with the mouse wheel.



         mode-mouse [on | off]
Mouse state in modes. If on, the mouse may be used to
enter copy mode and copy a selection by dragging, to
enter copy mode and scroll with the mouse wheel, or to
select an option in choice mode.


In my .tmux.conf:



set-window-option -g mode-mouse on





share|improve this answer


























  • That is the behaviour you really want! Mouse scroll enabling copy mode, not just scrolling the shell alternate buffer. That was finally the incentive to switch from screen to tmux for me. Is there an option to get the same behaviour also with Shift+PgUp?

    – kynan
    Dec 9 '11 at 13:24








  • 1





    @kynan: I personally just press C-A PgUp to do that. You can bind the page-up key directly with tmux bind-key -n PPage copy-mode -u. The similar thign should work for shift+pageup if you un-bind it from your local terminal.

    – bukzor
    Dec 12 '12 at 20:04






  • 1





    This results in an odd behaviour where, when I scroll back to the command line, I get an extra character inserted into the CLI, which usually results in my first command being malformed. It's pretty annoying.

    – Chris R
    Dec 27 '12 at 17:01











  • Note that, however this works fine for triggering the scroll with the mouse, it causes odd behavior when selecting text to be pasted with middle-click. I ended up preffering C-b pg-up/down (the default) since the tradeoff was not acceptable.

    – h7r
    May 14 '15 at 19:18











  • @ChrisR I get this quite a bit too and it isn't quite consistent. Is it a [M [M#[M [M#[M [M#[M [M#[M type of string?

    – Elijah Lynn
    Jan 8 '16 at 0:34



















52














Try this in your .tmux.conf



# Make mouse useful in copy mode
setw -g mode-mouse on

# Allow mouse to select which pane to use
set -g mouse-select-pane on

# Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right
set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=eOA:kDN5=eOB:kLFT5=eOD:kRIT5=eOC"

# Scroll History
set -g history-limit 30000

# Set ability to capture on start and restore on exit window data when running an application
setw -g alternate-screen on

# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
set -s escape-time 50


Taken from http://brainscraps.wikia.com/wiki/Extreme_Multitasking_with_tmux_and_PuTTY






share|improve this answer
























  • +1 for escape-time setting

    – Dakusan
    Feb 12 '18 at 19:22





















14














Someone (from a source I lost) suggested adding the following to ~.tmux.conf:



set -g terminal-overrides 'xterm*:smcup@:rmcup@'


I have no idea how it works or what it does, but this now allows me to scroll with the mouse wheel inside a tmux session without having to enter tmux's copy mode; I just scroll the wheel and BAM! it works. Note that I'm using terminal.app, but I remember the OP gave the answer specifically for use with gnome-terminal.






share|improve this answer





















  • 1





    Jed, thank you! Your advice works in gnome-terminal too. I will try to use this setup for some time. But it has a disadvantage: mouse scrolling now doesn't work as expected in less. If I load less inside tmux, mouse scrolling doesn't scroll the file opened in less. It scrolls the whole terminal. Strangely, vim behaves as expected inside tmux with your setup.

    – user31494
    Jul 14 '11 at 18:08








  • 2





    Note that as of tmux 1.5 this is superseded by the setw -g mode-mouse on option, which does copy mode scrollback using the mouse wheel.

    – kynan
    Dec 9 '11 at 13:30






  • 3





    The explanation is that this option disables the scroll lock on the terminal's alternate screen, which is desirable in most cases since applications requesting the alternate screen buffer (vi, less, tmux etc.) provide their own scrolling capabilities. Overriding this lock in tmux allows scrolling the terminal's alternate screen buffer which doesn't give the desired result in all but a few cases. See this answer for a quote from man xterm explaining alternate screen.

    – kynan
    Dec 9 '11 at 14:26













  • Alas, this doesn't work in iTerm

    – Suan
    Jan 18 '12 at 0:11











  • I've had positive results with this in iTerm 2

    – Keith Smiley
    May 17 '13 at 4:14



















5














tmux 2.1 introduces new mouse binds.



I wrote these binds just now today. It seamlessly binds mouse wheel to arrows when not in Vim, because Vim is capable of interpreting the raw mouse wheel codes (for purposes such as choosing which Vim window to scroll for you depending on which one your mouse is over).



This means we can finally use the mouse only to view multiple man pages and whatever else accepts arrow keys. You may extend and chain the if logic as necessary to implement more logic for your applications.



bind -n WheelUpPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Up"
bind -n WheelDownPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Down"


With this new wheel binding capability it is possible to script the mouse wheel to do any context sensitive behavior that you like.






share|improve this answer


























  • I'm now just sort of toying with the idea of making mousewheel on pane border do something interesting. Probably what I'll do is not map wheel on border but map it to cycle the tmux windows when done over the statusline.

    – Steven Lu
    Dec 15 '15 at 23:53











  • What's the link to your Github? I'd like to keep abreast of your efforts! Another feature I am looking for is to have double-click copy the word to the X clipboard, like it does outside of Tmux.

    – joeytwiddle
    Mar 30 '16 at 3:11











  • @joeytwiddle I highly recommend github.com/NHDaly/tmux-better-mouse-mode, see my other answer

    – Steven Lu
    Jan 2 '18 at 23:54



















3














Gnome-terminal does some neat trickery translating mouse scroll events to Up and Down arrow keys in conditions of restricted "usual" scrolling. For example, when you view some text using less (this happens in particular when you're reading a man), you can scroll the content using j, k, and arrow keys. But also, with gnome-terminal, you can do that with mouse scrolling, thanks to the mentioned trick.



So I guess tmux does some "capturing" of the terminal just like less - and the same mechanism in gnome-terminal kicks in: mouse scrolling translates into Up/Down arrow key presses.



You can turn this feature off in profile settings and get the regular scrolling in any circumstances. Just unmark the last checkbox in the "scrolling" tab: the checkbox.






share|improve this answer


























  • Thank you for explanation, uldtko! But it doesn't help with the mouse scrolling problem. Yes, with the option turned off, gnome-terminal stops sending triple ^[[A and ^[[B on mouse-scroll. It's nicer in tmux (no ugly ^[[A^[[A^[[A in some programs, no ugly command-history-scrolling), but now less stops scrolling on mouse-scroll.

    – user31494
    Dec 27 '10 at 14:48








  • 1





    Ukranian? (guessing by the i characters)

    – dotancohen
    Apr 18 '13 at 11:17



















1














https://github.com/NHDaly/tmux-better-mouse-mode



Configurable and feature-rich implementation of mouse control for newer tmuxes. highly recommended.



You likely want to use



set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"


with it also.






share|improve this answer


























  • I installed this but am no longer able to highlight and copy text with the mouse. Are you able to do this?

    – jonathanking
    Jan 11 at 18:03











  • Yes you likely have other mouse related tmux config present that conflicts with it.

    – Steven Lu
    Jan 11 at 22:02



















0














You can combine the binding ideas from the other answers to get a pretty satisfying scrolling behavior:
works in vim
changes to copy mode automatically in terminal and exits it when you reach the bottom
still allows you to use your mousewheel in man, less and journalctl.



My code:



bind -n WheelUpPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Up Up Up Up"  "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"
bind -n WheelDownPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Down Down Down Down" "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"


you can add other commands that require arrow keys for scrolling in the grep -e 'man' part



i added the send-keys multiple times, so one tick on the mousewheel will scroll 4 lines at a time






share|improve this answer































    0














    If you are already in a tmux session you can run the command



    set mouse on


    Reminder: to run commands, use your prefix then :.






    share|improve this answer
























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f210125%2fscroll-shell-output-with-mouse-in-tmux%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      10 Answers
      10






      active

      oldest

      votes








      10 Answers
      10






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      227














      To scroll within history of the output You would use ^b + [
      You can then use M+V to page up and ^V to page down. I don't know if You can use the real PgUp and PgDown though. My terminal does not send these keys to the tmux. Instead it scrolls itself and not the tmux history.



      To exit the copy mode, press ESC



      To use your mouse in this mode (called copy mode) press ^b + :
      and enter following:



      setw -g mouse on


      Note: In tmux < 2.1, the option was named mode-mouse, and not mouse



      Now when You change to the copy mode you can use your mouse to scroll through it.
      You can put this command in your ~/.tmux.conf if You want so it loads every time You run tmux.



      Update: As of tmux 1.5 this option makes using the scroll wheel automatically switch to copy mode and scroll back the tmux scrollback buffer. It is not necessary to first hit Ctrl-B + [ any more. Scrolling back down to the prompt also ends copy mode automatically.






      share|improve this answer





















      • 1





        Note that you may have to reload the config file if you already have a running tmux server. blog.sanctum.geek.nz/reloading-tmux-config tmux source-file ~/.tmux.conf

        – Allan Nienhuis
        Dec 1 '13 at 17:31






      • 7





        Not working for me on OS X.

        – Ain
        Mar 10 '15 at 13:27






      • 2





        @Ain - There are now 11 major versions of OS X. Which version are we talking about exactly?

        – Ramhound
        Jul 8 '15 at 12:24








      • 10





        For tmux >= 2.1, see @DannyRe's answer (currently quite far down).

        – joelostblom
        Dec 31 '15 at 18:07






      • 3





        set -g mouse on worked for me on macOS tmux 2.1

        – Miguel Mota
        Jan 5 '17 at 17:58


















      227














      To scroll within history of the output You would use ^b + [
      You can then use M+V to page up and ^V to page down. I don't know if You can use the real PgUp and PgDown though. My terminal does not send these keys to the tmux. Instead it scrolls itself and not the tmux history.



      To exit the copy mode, press ESC



      To use your mouse in this mode (called copy mode) press ^b + :
      and enter following:



      setw -g mouse on


      Note: In tmux < 2.1, the option was named mode-mouse, and not mouse



      Now when You change to the copy mode you can use your mouse to scroll through it.
      You can put this command in your ~/.tmux.conf if You want so it loads every time You run tmux.



      Update: As of tmux 1.5 this option makes using the scroll wheel automatically switch to copy mode and scroll back the tmux scrollback buffer. It is not necessary to first hit Ctrl-B + [ any more. Scrolling back down to the prompt also ends copy mode automatically.






      share|improve this answer





















      • 1





        Note that you may have to reload the config file if you already have a running tmux server. blog.sanctum.geek.nz/reloading-tmux-config tmux source-file ~/.tmux.conf

        – Allan Nienhuis
        Dec 1 '13 at 17:31






      • 7





        Not working for me on OS X.

        – Ain
        Mar 10 '15 at 13:27






      • 2





        @Ain - There are now 11 major versions of OS X. Which version are we talking about exactly?

        – Ramhound
        Jul 8 '15 at 12:24








      • 10





        For tmux >= 2.1, see @DannyRe's answer (currently quite far down).

        – joelostblom
        Dec 31 '15 at 18:07






      • 3





        set -g mouse on worked for me on macOS tmux 2.1

        – Miguel Mota
        Jan 5 '17 at 17:58
















      227












      227








      227







      To scroll within history of the output You would use ^b + [
      You can then use M+V to page up and ^V to page down. I don't know if You can use the real PgUp and PgDown though. My terminal does not send these keys to the tmux. Instead it scrolls itself and not the tmux history.



      To exit the copy mode, press ESC



      To use your mouse in this mode (called copy mode) press ^b + :
      and enter following:



      setw -g mouse on


      Note: In tmux < 2.1, the option was named mode-mouse, and not mouse



      Now when You change to the copy mode you can use your mouse to scroll through it.
      You can put this command in your ~/.tmux.conf if You want so it loads every time You run tmux.



      Update: As of tmux 1.5 this option makes using the scroll wheel automatically switch to copy mode and scroll back the tmux scrollback buffer. It is not necessary to first hit Ctrl-B + [ any more. Scrolling back down to the prompt also ends copy mode automatically.






      share|improve this answer















      To scroll within history of the output You would use ^b + [
      You can then use M+V to page up and ^V to page down. I don't know if You can use the real PgUp and PgDown though. My terminal does not send these keys to the tmux. Instead it scrolls itself and not the tmux history.



      To exit the copy mode, press ESC



      To use your mouse in this mode (called copy mode) press ^b + :
      and enter following:



      setw -g mouse on


      Note: In tmux < 2.1, the option was named mode-mouse, and not mouse



      Now when You change to the copy mode you can use your mouse to scroll through it.
      You can put this command in your ~/.tmux.conf if You want so it loads every time You run tmux.



      Update: As of tmux 1.5 this option makes using the scroll wheel automatically switch to copy mode and scroll back the tmux scrollback buffer. It is not necessary to first hit Ctrl-B + [ any more. Scrolling back down to the prompt also ends copy mode automatically.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 19 '18 at 21:38









      Community

      1




      1










      answered Dec 1 '10 at 18:48









      PavloPavlo

      2,3711103




      2,3711103








      • 1





        Note that you may have to reload the config file if you already have a running tmux server. blog.sanctum.geek.nz/reloading-tmux-config tmux source-file ~/.tmux.conf

        – Allan Nienhuis
        Dec 1 '13 at 17:31






      • 7





        Not working for me on OS X.

        – Ain
        Mar 10 '15 at 13:27






      • 2





        @Ain - There are now 11 major versions of OS X. Which version are we talking about exactly?

        – Ramhound
        Jul 8 '15 at 12:24








      • 10





        For tmux >= 2.1, see @DannyRe's answer (currently quite far down).

        – joelostblom
        Dec 31 '15 at 18:07






      • 3





        set -g mouse on worked for me on macOS tmux 2.1

        – Miguel Mota
        Jan 5 '17 at 17:58
















      • 1





        Note that you may have to reload the config file if you already have a running tmux server. blog.sanctum.geek.nz/reloading-tmux-config tmux source-file ~/.tmux.conf

        – Allan Nienhuis
        Dec 1 '13 at 17:31






      • 7





        Not working for me on OS X.

        – Ain
        Mar 10 '15 at 13:27






      • 2





        @Ain - There are now 11 major versions of OS X. Which version are we talking about exactly?

        – Ramhound
        Jul 8 '15 at 12:24








      • 10





        For tmux >= 2.1, see @DannyRe's answer (currently quite far down).

        – joelostblom
        Dec 31 '15 at 18:07






      • 3





        set -g mouse on worked for me on macOS tmux 2.1

        – Miguel Mota
        Jan 5 '17 at 17:58










      1




      1





      Note that you may have to reload the config file if you already have a running tmux server. blog.sanctum.geek.nz/reloading-tmux-config tmux source-file ~/.tmux.conf

      – Allan Nienhuis
      Dec 1 '13 at 17:31





      Note that you may have to reload the config file if you already have a running tmux server. blog.sanctum.geek.nz/reloading-tmux-config tmux source-file ~/.tmux.conf

      – Allan Nienhuis
      Dec 1 '13 at 17:31




      7




      7





      Not working for me on OS X.

      – Ain
      Mar 10 '15 at 13:27





      Not working for me on OS X.

      – Ain
      Mar 10 '15 at 13:27




      2




      2





      @Ain - There are now 11 major versions of OS X. Which version are we talking about exactly?

      – Ramhound
      Jul 8 '15 at 12:24







      @Ain - There are now 11 major versions of OS X. Which version are we talking about exactly?

      – Ramhound
      Jul 8 '15 at 12:24






      10




      10





      For tmux >= 2.1, see @DannyRe's answer (currently quite far down).

      – joelostblom
      Dec 31 '15 at 18:07





      For tmux >= 2.1, see @DannyRe's answer (currently quite far down).

      – joelostblom
      Dec 31 '15 at 18:07




      3




      3





      set -g mouse on worked for me on macOS tmux 2.1

      – Miguel Mota
      Jan 5 '17 at 17:58







      set -g mouse on worked for me on macOS tmux 2.1

      – Miguel Mota
      Jan 5 '17 at 17:58















      119














      There are some changes for Tmux 2.1





      • Mouse-mode has been rewritten. There's now no longer options for:




        • mouse-resize-pane

        • mouse-select-pane

        • mouse-select-window

        • mode-mouse


        Instead there is just one option: 'mouse' which turns on mouse support
        entirely.




      That would be



      set -g mouse on
      # to enable mouse scroll, see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
      bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"





      share|improve this answer





















      • 6





        Thanks, now selecting panes, etc work, but scrolling doesn't. In order to make scrolling work again, use this: github.com/NHDaly/tmux-scroll-copy-mode

        – Mahdi
        Oct 20 '15 at 20:15








      • 1





        awesome - this even works on cygwin - tmux on WINDOWS 7

        – GWD
        Jan 21 '16 at 15:52











      • @Mahdi This seems to not work on osx. Any hints?

        – DiTTiD
        Feb 11 '16 at 8:39











      • @SolidSnake: I don't remember facing any issues using that plugin. It worked smoothly, I enabled mouse mode and then installed it. You should reload your tmux config using tmux source-file ~/.tmux.conf

        – Mahdi
        Feb 11 '16 at 20:01






      • 1





        bind doesn't seem to be necessary anymore on tmux 2.3

        – Theron Luhn
        Dec 5 '16 at 18:49
















      119














      There are some changes for Tmux 2.1





      • Mouse-mode has been rewritten. There's now no longer options for:




        • mouse-resize-pane

        • mouse-select-pane

        • mouse-select-window

        • mode-mouse


        Instead there is just one option: 'mouse' which turns on mouse support
        entirely.




      That would be



      set -g mouse on
      # to enable mouse scroll, see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
      bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"





      share|improve this answer





















      • 6





        Thanks, now selecting panes, etc work, but scrolling doesn't. In order to make scrolling work again, use this: github.com/NHDaly/tmux-scroll-copy-mode

        – Mahdi
        Oct 20 '15 at 20:15








      • 1





        awesome - this even works on cygwin - tmux on WINDOWS 7

        – GWD
        Jan 21 '16 at 15:52











      • @Mahdi This seems to not work on osx. Any hints?

        – DiTTiD
        Feb 11 '16 at 8:39











      • @SolidSnake: I don't remember facing any issues using that plugin. It worked smoothly, I enabled mouse mode and then installed it. You should reload your tmux config using tmux source-file ~/.tmux.conf

        – Mahdi
        Feb 11 '16 at 20:01






      • 1





        bind doesn't seem to be necessary anymore on tmux 2.3

        – Theron Luhn
        Dec 5 '16 at 18:49














      119












      119








      119







      There are some changes for Tmux 2.1





      • Mouse-mode has been rewritten. There's now no longer options for:




        • mouse-resize-pane

        • mouse-select-pane

        • mouse-select-window

        • mode-mouse


        Instead there is just one option: 'mouse' which turns on mouse support
        entirely.




      That would be



      set -g mouse on
      # to enable mouse scroll, see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
      bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"





      share|improve this answer















      There are some changes for Tmux 2.1





      • Mouse-mode has been rewritten. There's now no longer options for:




        • mouse-resize-pane

        • mouse-select-pane

        • mouse-select-window

        • mode-mouse


        Instead there is just one option: 'mouse' which turns on mouse support
        entirely.




      That would be



      set -g mouse on
      # to enable mouse scroll, see https://github.com/tmux/tmux/issues/145#issuecomment-150736967
      bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Oct 24 '15 at 11:31









      Olivier Lalonde

      3,93262330




      3,93262330










      answered Oct 19 '15 at 11:02









      DannyReDannyRe

      1,293187




      1,293187








      • 6





        Thanks, now selecting panes, etc work, but scrolling doesn't. In order to make scrolling work again, use this: github.com/NHDaly/tmux-scroll-copy-mode

        – Mahdi
        Oct 20 '15 at 20:15








      • 1





        awesome - this even works on cygwin - tmux on WINDOWS 7

        – GWD
        Jan 21 '16 at 15:52











      • @Mahdi This seems to not work on osx. Any hints?

        – DiTTiD
        Feb 11 '16 at 8:39











      • @SolidSnake: I don't remember facing any issues using that plugin. It worked smoothly, I enabled mouse mode and then installed it. You should reload your tmux config using tmux source-file ~/.tmux.conf

        – Mahdi
        Feb 11 '16 at 20:01






      • 1





        bind doesn't seem to be necessary anymore on tmux 2.3

        – Theron Luhn
        Dec 5 '16 at 18:49














      • 6





        Thanks, now selecting panes, etc work, but scrolling doesn't. In order to make scrolling work again, use this: github.com/NHDaly/tmux-scroll-copy-mode

        – Mahdi
        Oct 20 '15 at 20:15








      • 1





        awesome - this even works on cygwin - tmux on WINDOWS 7

        – GWD
        Jan 21 '16 at 15:52











      • @Mahdi This seems to not work on osx. Any hints?

        – DiTTiD
        Feb 11 '16 at 8:39











      • @SolidSnake: I don't remember facing any issues using that plugin. It worked smoothly, I enabled mouse mode and then installed it. You should reload your tmux config using tmux source-file ~/.tmux.conf

        – Mahdi
        Feb 11 '16 at 20:01






      • 1





        bind doesn't seem to be necessary anymore on tmux 2.3

        – Theron Luhn
        Dec 5 '16 at 18:49








      6




      6





      Thanks, now selecting panes, etc work, but scrolling doesn't. In order to make scrolling work again, use this: github.com/NHDaly/tmux-scroll-copy-mode

      – Mahdi
      Oct 20 '15 at 20:15







      Thanks, now selecting panes, etc work, but scrolling doesn't. In order to make scrolling work again, use this: github.com/NHDaly/tmux-scroll-copy-mode

      – Mahdi
      Oct 20 '15 at 20:15






      1




      1





      awesome - this even works on cygwin - tmux on WINDOWS 7

      – GWD
      Jan 21 '16 at 15:52





      awesome - this even works on cygwin - tmux on WINDOWS 7

      – GWD
      Jan 21 '16 at 15:52













      @Mahdi This seems to not work on osx. Any hints?

      – DiTTiD
      Feb 11 '16 at 8:39





      @Mahdi This seems to not work on osx. Any hints?

      – DiTTiD
      Feb 11 '16 at 8:39













      @SolidSnake: I don't remember facing any issues using that plugin. It worked smoothly, I enabled mouse mode and then installed it. You should reload your tmux config using tmux source-file ~/.tmux.conf

      – Mahdi
      Feb 11 '16 at 20:01





      @SolidSnake: I don't remember facing any issues using that plugin. It worked smoothly, I enabled mouse mode and then installed it. You should reload your tmux config using tmux source-file ~/.tmux.conf

      – Mahdi
      Feb 11 '16 at 20:01




      1




      1





      bind doesn't seem to be necessary anymore on tmux 2.3

      – Theron Luhn
      Dec 5 '16 at 18:49





      bind doesn't seem to be necessary anymore on tmux 2.3

      – Theron Luhn
      Dec 5 '16 at 18:49











      61














      The current version of tmux (1.5) lets you simply set the mode-mouse option on, and allows you to scroll with the mouse wheel.



               mode-mouse [on | off]
      Mouse state in modes. If on, the mouse may be used to
      enter copy mode and copy a selection by dragging, to
      enter copy mode and scroll with the mouse wheel, or to
      select an option in choice mode.


      In my .tmux.conf:



      set-window-option -g mode-mouse on





      share|improve this answer


























      • That is the behaviour you really want! Mouse scroll enabling copy mode, not just scrolling the shell alternate buffer. That was finally the incentive to switch from screen to tmux for me. Is there an option to get the same behaviour also with Shift+PgUp?

        – kynan
        Dec 9 '11 at 13:24








      • 1





        @kynan: I personally just press C-A PgUp to do that. You can bind the page-up key directly with tmux bind-key -n PPage copy-mode -u. The similar thign should work for shift+pageup if you un-bind it from your local terminal.

        – bukzor
        Dec 12 '12 at 20:04






      • 1





        This results in an odd behaviour where, when I scroll back to the command line, I get an extra character inserted into the CLI, which usually results in my first command being malformed. It's pretty annoying.

        – Chris R
        Dec 27 '12 at 17:01











      • Note that, however this works fine for triggering the scroll with the mouse, it causes odd behavior when selecting text to be pasted with middle-click. I ended up preffering C-b pg-up/down (the default) since the tradeoff was not acceptable.

        – h7r
        May 14 '15 at 19:18











      • @ChrisR I get this quite a bit too and it isn't quite consistent. Is it a [M [M#[M [M#[M [M#[M [M#[M type of string?

        – Elijah Lynn
        Jan 8 '16 at 0:34
















      61














      The current version of tmux (1.5) lets you simply set the mode-mouse option on, and allows you to scroll with the mouse wheel.



               mode-mouse [on | off]
      Mouse state in modes. If on, the mouse may be used to
      enter copy mode and copy a selection by dragging, to
      enter copy mode and scroll with the mouse wheel, or to
      select an option in choice mode.


      In my .tmux.conf:



      set-window-option -g mode-mouse on





      share|improve this answer


























      • That is the behaviour you really want! Mouse scroll enabling copy mode, not just scrolling the shell alternate buffer. That was finally the incentive to switch from screen to tmux for me. Is there an option to get the same behaviour also with Shift+PgUp?

        – kynan
        Dec 9 '11 at 13:24








      • 1





        @kynan: I personally just press C-A PgUp to do that. You can bind the page-up key directly with tmux bind-key -n PPage copy-mode -u. The similar thign should work for shift+pageup if you un-bind it from your local terminal.

        – bukzor
        Dec 12 '12 at 20:04






      • 1





        This results in an odd behaviour where, when I scroll back to the command line, I get an extra character inserted into the CLI, which usually results in my first command being malformed. It's pretty annoying.

        – Chris R
        Dec 27 '12 at 17:01











      • Note that, however this works fine for triggering the scroll with the mouse, it causes odd behavior when selecting text to be pasted with middle-click. I ended up preffering C-b pg-up/down (the default) since the tradeoff was not acceptable.

        – h7r
        May 14 '15 at 19:18











      • @ChrisR I get this quite a bit too and it isn't quite consistent. Is it a [M [M#[M [M#[M [M#[M [M#[M type of string?

        – Elijah Lynn
        Jan 8 '16 at 0:34














      61












      61








      61







      The current version of tmux (1.5) lets you simply set the mode-mouse option on, and allows you to scroll with the mouse wheel.



               mode-mouse [on | off]
      Mouse state in modes. If on, the mouse may be used to
      enter copy mode and copy a selection by dragging, to
      enter copy mode and scroll with the mouse wheel, or to
      select an option in choice mode.


      In my .tmux.conf:



      set-window-option -g mode-mouse on





      share|improve this answer















      The current version of tmux (1.5) lets you simply set the mode-mouse option on, and allows you to scroll with the mouse wheel.



               mode-mouse [on | off]
      Mouse state in modes. If on, the mouse may be used to
      enter copy mode and copy a selection by dragging, to
      enter copy mode and scroll with the mouse wheel, or to
      select an option in choice mode.


      In my .tmux.conf:



      set-window-option -g mode-mouse on






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited May 9 '12 at 17:31









      EdSG

      386




      386










      answered Nov 15 '11 at 20:05









      bukzorbukzor

      1,30521221




      1,30521221













      • That is the behaviour you really want! Mouse scroll enabling copy mode, not just scrolling the shell alternate buffer. That was finally the incentive to switch from screen to tmux for me. Is there an option to get the same behaviour also with Shift+PgUp?

        – kynan
        Dec 9 '11 at 13:24








      • 1





        @kynan: I personally just press C-A PgUp to do that. You can bind the page-up key directly with tmux bind-key -n PPage copy-mode -u. The similar thign should work for shift+pageup if you un-bind it from your local terminal.

        – bukzor
        Dec 12 '12 at 20:04






      • 1





        This results in an odd behaviour where, when I scroll back to the command line, I get an extra character inserted into the CLI, which usually results in my first command being malformed. It's pretty annoying.

        – Chris R
        Dec 27 '12 at 17:01











      • Note that, however this works fine for triggering the scroll with the mouse, it causes odd behavior when selecting text to be pasted with middle-click. I ended up preffering C-b pg-up/down (the default) since the tradeoff was not acceptable.

        – h7r
        May 14 '15 at 19:18











      • @ChrisR I get this quite a bit too and it isn't quite consistent. Is it a [M [M#[M [M#[M [M#[M [M#[M type of string?

        – Elijah Lynn
        Jan 8 '16 at 0:34



















      • That is the behaviour you really want! Mouse scroll enabling copy mode, not just scrolling the shell alternate buffer. That was finally the incentive to switch from screen to tmux for me. Is there an option to get the same behaviour also with Shift+PgUp?

        – kynan
        Dec 9 '11 at 13:24








      • 1





        @kynan: I personally just press C-A PgUp to do that. You can bind the page-up key directly with tmux bind-key -n PPage copy-mode -u. The similar thign should work for shift+pageup if you un-bind it from your local terminal.

        – bukzor
        Dec 12 '12 at 20:04






      • 1





        This results in an odd behaviour where, when I scroll back to the command line, I get an extra character inserted into the CLI, which usually results in my first command being malformed. It's pretty annoying.

        – Chris R
        Dec 27 '12 at 17:01











      • Note that, however this works fine for triggering the scroll with the mouse, it causes odd behavior when selecting text to be pasted with middle-click. I ended up preffering C-b pg-up/down (the default) since the tradeoff was not acceptable.

        – h7r
        May 14 '15 at 19:18











      • @ChrisR I get this quite a bit too and it isn't quite consistent. Is it a [M [M#[M [M#[M [M#[M [M#[M type of string?

        – Elijah Lynn
        Jan 8 '16 at 0:34

















      That is the behaviour you really want! Mouse scroll enabling copy mode, not just scrolling the shell alternate buffer. That was finally the incentive to switch from screen to tmux for me. Is there an option to get the same behaviour also with Shift+PgUp?

      – kynan
      Dec 9 '11 at 13:24







      That is the behaviour you really want! Mouse scroll enabling copy mode, not just scrolling the shell alternate buffer. That was finally the incentive to switch from screen to tmux for me. Is there an option to get the same behaviour also with Shift+PgUp?

      – kynan
      Dec 9 '11 at 13:24






      1




      1





      @kynan: I personally just press C-A PgUp to do that. You can bind the page-up key directly with tmux bind-key -n PPage copy-mode -u. The similar thign should work for shift+pageup if you un-bind it from your local terminal.

      – bukzor
      Dec 12 '12 at 20:04





      @kynan: I personally just press C-A PgUp to do that. You can bind the page-up key directly with tmux bind-key -n PPage copy-mode -u. The similar thign should work for shift+pageup if you un-bind it from your local terminal.

      – bukzor
      Dec 12 '12 at 20:04




      1




      1





      This results in an odd behaviour where, when I scroll back to the command line, I get an extra character inserted into the CLI, which usually results in my first command being malformed. It's pretty annoying.

      – Chris R
      Dec 27 '12 at 17:01





      This results in an odd behaviour where, when I scroll back to the command line, I get an extra character inserted into the CLI, which usually results in my first command being malformed. It's pretty annoying.

      – Chris R
      Dec 27 '12 at 17:01













      Note that, however this works fine for triggering the scroll with the mouse, it causes odd behavior when selecting text to be pasted with middle-click. I ended up preffering C-b pg-up/down (the default) since the tradeoff was not acceptable.

      – h7r
      May 14 '15 at 19:18





      Note that, however this works fine for triggering the scroll with the mouse, it causes odd behavior when selecting text to be pasted with middle-click. I ended up preffering C-b pg-up/down (the default) since the tradeoff was not acceptable.

      – h7r
      May 14 '15 at 19:18













      @ChrisR I get this quite a bit too and it isn't quite consistent. Is it a [M [M#[M [M#[M [M#[M [M#[M type of string?

      – Elijah Lynn
      Jan 8 '16 at 0:34





      @ChrisR I get this quite a bit too and it isn't quite consistent. Is it a [M [M#[M [M#[M [M#[M [M#[M type of string?

      – Elijah Lynn
      Jan 8 '16 at 0:34











      52














      Try this in your .tmux.conf



      # Make mouse useful in copy mode
      setw -g mode-mouse on

      # Allow mouse to select which pane to use
      set -g mouse-select-pane on

      # Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right
      set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=eOA:kDN5=eOB:kLFT5=eOD:kRIT5=eOC"

      # Scroll History
      set -g history-limit 30000

      # Set ability to capture on start and restore on exit window data when running an application
      setw -g alternate-screen on

      # Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
      set -s escape-time 50


      Taken from http://brainscraps.wikia.com/wiki/Extreme_Multitasking_with_tmux_and_PuTTY






      share|improve this answer
























      • +1 for escape-time setting

        – Dakusan
        Feb 12 '18 at 19:22


















      52














      Try this in your .tmux.conf



      # Make mouse useful in copy mode
      setw -g mode-mouse on

      # Allow mouse to select which pane to use
      set -g mouse-select-pane on

      # Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right
      set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=eOA:kDN5=eOB:kLFT5=eOD:kRIT5=eOC"

      # Scroll History
      set -g history-limit 30000

      # Set ability to capture on start and restore on exit window data when running an application
      setw -g alternate-screen on

      # Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
      set -s escape-time 50


      Taken from http://brainscraps.wikia.com/wiki/Extreme_Multitasking_with_tmux_and_PuTTY






      share|improve this answer
























      • +1 for escape-time setting

        – Dakusan
        Feb 12 '18 at 19:22
















      52












      52








      52







      Try this in your .tmux.conf



      # Make mouse useful in copy mode
      setw -g mode-mouse on

      # Allow mouse to select which pane to use
      set -g mouse-select-pane on

      # Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right
      set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=eOA:kDN5=eOB:kLFT5=eOD:kRIT5=eOC"

      # Scroll History
      set -g history-limit 30000

      # Set ability to capture on start and restore on exit window data when running an application
      setw -g alternate-screen on

      # Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
      set -s escape-time 50


      Taken from http://brainscraps.wikia.com/wiki/Extreme_Multitasking_with_tmux_and_PuTTY






      share|improve this answer













      Try this in your .tmux.conf



      # Make mouse useful in copy mode
      setw -g mode-mouse on

      # Allow mouse to select which pane to use
      set -g mouse-select-pane on

      # Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right
      set -g terminal-overrides "xterm*:XT:smcup@:rmcup@:kUP5=eOA:kDN5=eOB:kLFT5=eOD:kRIT5=eOC"

      # Scroll History
      set -g history-limit 30000

      # Set ability to capture on start and restore on exit window data when running an application
      setw -g alternate-screen on

      # Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
      set -s escape-time 50


      Taken from http://brainscraps.wikia.com/wiki/Extreme_Multitasking_with_tmux_and_PuTTY







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Oct 24 '12 at 16:55









      John L. JegutanisJohn L. Jegutanis

      62154




      62154













      • +1 for escape-time setting

        – Dakusan
        Feb 12 '18 at 19:22





















      • +1 for escape-time setting

        – Dakusan
        Feb 12 '18 at 19:22



















      +1 for escape-time setting

      – Dakusan
      Feb 12 '18 at 19:22







      +1 for escape-time setting

      – Dakusan
      Feb 12 '18 at 19:22













      14














      Someone (from a source I lost) suggested adding the following to ~.tmux.conf:



      set -g terminal-overrides 'xterm*:smcup@:rmcup@'


      I have no idea how it works or what it does, but this now allows me to scroll with the mouse wheel inside a tmux session without having to enter tmux's copy mode; I just scroll the wheel and BAM! it works. Note that I'm using terminal.app, but I remember the OP gave the answer specifically for use with gnome-terminal.






      share|improve this answer





















      • 1





        Jed, thank you! Your advice works in gnome-terminal too. I will try to use this setup for some time. But it has a disadvantage: mouse scrolling now doesn't work as expected in less. If I load less inside tmux, mouse scrolling doesn't scroll the file opened in less. It scrolls the whole terminal. Strangely, vim behaves as expected inside tmux with your setup.

        – user31494
        Jul 14 '11 at 18:08








      • 2





        Note that as of tmux 1.5 this is superseded by the setw -g mode-mouse on option, which does copy mode scrollback using the mouse wheel.

        – kynan
        Dec 9 '11 at 13:30






      • 3





        The explanation is that this option disables the scroll lock on the terminal's alternate screen, which is desirable in most cases since applications requesting the alternate screen buffer (vi, less, tmux etc.) provide their own scrolling capabilities. Overriding this lock in tmux allows scrolling the terminal's alternate screen buffer which doesn't give the desired result in all but a few cases. See this answer for a quote from man xterm explaining alternate screen.

        – kynan
        Dec 9 '11 at 14:26













      • Alas, this doesn't work in iTerm

        – Suan
        Jan 18 '12 at 0:11











      • I've had positive results with this in iTerm 2

        – Keith Smiley
        May 17 '13 at 4:14
















      14














      Someone (from a source I lost) suggested adding the following to ~.tmux.conf:



      set -g terminal-overrides 'xterm*:smcup@:rmcup@'


      I have no idea how it works or what it does, but this now allows me to scroll with the mouse wheel inside a tmux session without having to enter tmux's copy mode; I just scroll the wheel and BAM! it works. Note that I'm using terminal.app, but I remember the OP gave the answer specifically for use with gnome-terminal.






      share|improve this answer





















      • 1





        Jed, thank you! Your advice works in gnome-terminal too. I will try to use this setup for some time. But it has a disadvantage: mouse scrolling now doesn't work as expected in less. If I load less inside tmux, mouse scrolling doesn't scroll the file opened in less. It scrolls the whole terminal. Strangely, vim behaves as expected inside tmux with your setup.

        – user31494
        Jul 14 '11 at 18:08








      • 2





        Note that as of tmux 1.5 this is superseded by the setw -g mode-mouse on option, which does copy mode scrollback using the mouse wheel.

        – kynan
        Dec 9 '11 at 13:30






      • 3





        The explanation is that this option disables the scroll lock on the terminal's alternate screen, which is desirable in most cases since applications requesting the alternate screen buffer (vi, less, tmux etc.) provide their own scrolling capabilities. Overriding this lock in tmux allows scrolling the terminal's alternate screen buffer which doesn't give the desired result in all but a few cases. See this answer for a quote from man xterm explaining alternate screen.

        – kynan
        Dec 9 '11 at 14:26













      • Alas, this doesn't work in iTerm

        – Suan
        Jan 18 '12 at 0:11











      • I've had positive results with this in iTerm 2

        – Keith Smiley
        May 17 '13 at 4:14














      14












      14








      14







      Someone (from a source I lost) suggested adding the following to ~.tmux.conf:



      set -g terminal-overrides 'xterm*:smcup@:rmcup@'


      I have no idea how it works or what it does, but this now allows me to scroll with the mouse wheel inside a tmux session without having to enter tmux's copy mode; I just scroll the wheel and BAM! it works. Note that I'm using terminal.app, but I remember the OP gave the answer specifically for use with gnome-terminal.






      share|improve this answer















      Someone (from a source I lost) suggested adding the following to ~.tmux.conf:



      set -g terminal-overrides 'xterm*:smcup@:rmcup@'


      I have no idea how it works or what it does, but this now allows me to scroll with the mouse wheel inside a tmux session without having to enter tmux's copy mode; I just scroll the wheel and BAM! it works. Note that I'm using terminal.app, but I remember the OP gave the answer specifically for use with gnome-terminal.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Aug 15 '12 at 9:26









      Tshepang

      2,66631729




      2,66631729










      answered Jun 22 '11 at 17:10









      Jed DanielsJed Daniels

      1,061814




      1,061814








      • 1





        Jed, thank you! Your advice works in gnome-terminal too. I will try to use this setup for some time. But it has a disadvantage: mouse scrolling now doesn't work as expected in less. If I load less inside tmux, mouse scrolling doesn't scroll the file opened in less. It scrolls the whole terminal. Strangely, vim behaves as expected inside tmux with your setup.

        – user31494
        Jul 14 '11 at 18:08








      • 2





        Note that as of tmux 1.5 this is superseded by the setw -g mode-mouse on option, which does copy mode scrollback using the mouse wheel.

        – kynan
        Dec 9 '11 at 13:30






      • 3





        The explanation is that this option disables the scroll lock on the terminal's alternate screen, which is desirable in most cases since applications requesting the alternate screen buffer (vi, less, tmux etc.) provide their own scrolling capabilities. Overriding this lock in tmux allows scrolling the terminal's alternate screen buffer which doesn't give the desired result in all but a few cases. See this answer for a quote from man xterm explaining alternate screen.

        – kynan
        Dec 9 '11 at 14:26













      • Alas, this doesn't work in iTerm

        – Suan
        Jan 18 '12 at 0:11











      • I've had positive results with this in iTerm 2

        – Keith Smiley
        May 17 '13 at 4:14














      • 1





        Jed, thank you! Your advice works in gnome-terminal too. I will try to use this setup for some time. But it has a disadvantage: mouse scrolling now doesn't work as expected in less. If I load less inside tmux, mouse scrolling doesn't scroll the file opened in less. It scrolls the whole terminal. Strangely, vim behaves as expected inside tmux with your setup.

        – user31494
        Jul 14 '11 at 18:08








      • 2





        Note that as of tmux 1.5 this is superseded by the setw -g mode-mouse on option, which does copy mode scrollback using the mouse wheel.

        – kynan
        Dec 9 '11 at 13:30






      • 3





        The explanation is that this option disables the scroll lock on the terminal's alternate screen, which is desirable in most cases since applications requesting the alternate screen buffer (vi, less, tmux etc.) provide their own scrolling capabilities. Overriding this lock in tmux allows scrolling the terminal's alternate screen buffer which doesn't give the desired result in all but a few cases. See this answer for a quote from man xterm explaining alternate screen.

        – kynan
        Dec 9 '11 at 14:26













      • Alas, this doesn't work in iTerm

        – Suan
        Jan 18 '12 at 0:11











      • I've had positive results with this in iTerm 2

        – Keith Smiley
        May 17 '13 at 4:14








      1




      1





      Jed, thank you! Your advice works in gnome-terminal too. I will try to use this setup for some time. But it has a disadvantage: mouse scrolling now doesn't work as expected in less. If I load less inside tmux, mouse scrolling doesn't scroll the file opened in less. It scrolls the whole terminal. Strangely, vim behaves as expected inside tmux with your setup.

      – user31494
      Jul 14 '11 at 18:08







      Jed, thank you! Your advice works in gnome-terminal too. I will try to use this setup for some time. But it has a disadvantage: mouse scrolling now doesn't work as expected in less. If I load less inside tmux, mouse scrolling doesn't scroll the file opened in less. It scrolls the whole terminal. Strangely, vim behaves as expected inside tmux with your setup.

      – user31494
      Jul 14 '11 at 18:08






      2




      2





      Note that as of tmux 1.5 this is superseded by the setw -g mode-mouse on option, which does copy mode scrollback using the mouse wheel.

      – kynan
      Dec 9 '11 at 13:30





      Note that as of tmux 1.5 this is superseded by the setw -g mode-mouse on option, which does copy mode scrollback using the mouse wheel.

      – kynan
      Dec 9 '11 at 13:30




      3




      3





      The explanation is that this option disables the scroll lock on the terminal's alternate screen, which is desirable in most cases since applications requesting the alternate screen buffer (vi, less, tmux etc.) provide their own scrolling capabilities. Overriding this lock in tmux allows scrolling the terminal's alternate screen buffer which doesn't give the desired result in all but a few cases. See this answer for a quote from man xterm explaining alternate screen.

      – kynan
      Dec 9 '11 at 14:26







      The explanation is that this option disables the scroll lock on the terminal's alternate screen, which is desirable in most cases since applications requesting the alternate screen buffer (vi, less, tmux etc.) provide their own scrolling capabilities. Overriding this lock in tmux allows scrolling the terminal's alternate screen buffer which doesn't give the desired result in all but a few cases. See this answer for a quote from man xterm explaining alternate screen.

      – kynan
      Dec 9 '11 at 14:26















      Alas, this doesn't work in iTerm

      – Suan
      Jan 18 '12 at 0:11





      Alas, this doesn't work in iTerm

      – Suan
      Jan 18 '12 at 0:11













      I've had positive results with this in iTerm 2

      – Keith Smiley
      May 17 '13 at 4:14





      I've had positive results with this in iTerm 2

      – Keith Smiley
      May 17 '13 at 4:14











      5














      tmux 2.1 introduces new mouse binds.



      I wrote these binds just now today. It seamlessly binds mouse wheel to arrows when not in Vim, because Vim is capable of interpreting the raw mouse wheel codes (for purposes such as choosing which Vim window to scroll for you depending on which one your mouse is over).



      This means we can finally use the mouse only to view multiple man pages and whatever else accepts arrow keys. You may extend and chain the if logic as necessary to implement more logic for your applications.



      bind -n WheelUpPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Up"
      bind -n WheelDownPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Down"


      With this new wheel binding capability it is possible to script the mouse wheel to do any context sensitive behavior that you like.






      share|improve this answer


























      • I'm now just sort of toying with the idea of making mousewheel on pane border do something interesting. Probably what I'll do is not map wheel on border but map it to cycle the tmux windows when done over the statusline.

        – Steven Lu
        Dec 15 '15 at 23:53











      • What's the link to your Github? I'd like to keep abreast of your efforts! Another feature I am looking for is to have double-click copy the word to the X clipboard, like it does outside of Tmux.

        – joeytwiddle
        Mar 30 '16 at 3:11











      • @joeytwiddle I highly recommend github.com/NHDaly/tmux-better-mouse-mode, see my other answer

        – Steven Lu
        Jan 2 '18 at 23:54
















      5














      tmux 2.1 introduces new mouse binds.



      I wrote these binds just now today. It seamlessly binds mouse wheel to arrows when not in Vim, because Vim is capable of interpreting the raw mouse wheel codes (for purposes such as choosing which Vim window to scroll for you depending on which one your mouse is over).



      This means we can finally use the mouse only to view multiple man pages and whatever else accepts arrow keys. You may extend and chain the if logic as necessary to implement more logic for your applications.



      bind -n WheelUpPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Up"
      bind -n WheelDownPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Down"


      With this new wheel binding capability it is possible to script the mouse wheel to do any context sensitive behavior that you like.






      share|improve this answer


























      • I'm now just sort of toying with the idea of making mousewheel on pane border do something interesting. Probably what I'll do is not map wheel on border but map it to cycle the tmux windows when done over the statusline.

        – Steven Lu
        Dec 15 '15 at 23:53











      • What's the link to your Github? I'd like to keep abreast of your efforts! Another feature I am looking for is to have double-click copy the word to the X clipboard, like it does outside of Tmux.

        – joeytwiddle
        Mar 30 '16 at 3:11











      • @joeytwiddle I highly recommend github.com/NHDaly/tmux-better-mouse-mode, see my other answer

        – Steven Lu
        Jan 2 '18 at 23:54














      5












      5








      5







      tmux 2.1 introduces new mouse binds.



      I wrote these binds just now today. It seamlessly binds mouse wheel to arrows when not in Vim, because Vim is capable of interpreting the raw mouse wheel codes (for purposes such as choosing which Vim window to scroll for you depending on which one your mouse is over).



      This means we can finally use the mouse only to view multiple man pages and whatever else accepts arrow keys. You may extend and chain the if logic as necessary to implement more logic for your applications.



      bind -n WheelUpPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Up"
      bind -n WheelDownPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Down"


      With this new wheel binding capability it is possible to script the mouse wheel to do any context sensitive behavior that you like.






      share|improve this answer















      tmux 2.1 introduces new mouse binds.



      I wrote these binds just now today. It seamlessly binds mouse wheel to arrows when not in Vim, because Vim is capable of interpreting the raw mouse wheel codes (for purposes such as choosing which Vim window to scroll for you depending on which one your mouse is over).



      This means we can finally use the mouse only to view multiple man pages and whatever else accepts arrow keys. You may extend and chain the if logic as necessary to implement more logic for your applications.



      bind -n WheelUpPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Up"
      bind -n WheelDownPane if "[[ #{pane_current_command} =~ vim ]]" "select-pane -t = ; send-keys -M" "select-pane -t = ; send-keys Down"


      With this new wheel binding capability it is possible to script the mouse wheel to do any context sensitive behavior that you like.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jan 2 '18 at 23:55

























      answered Dec 15 '15 at 23:44









      Steven LuSteven Lu

      1,55312435




      1,55312435













      • I'm now just sort of toying with the idea of making mousewheel on pane border do something interesting. Probably what I'll do is not map wheel on border but map it to cycle the tmux windows when done over the statusline.

        – Steven Lu
        Dec 15 '15 at 23:53











      • What's the link to your Github? I'd like to keep abreast of your efforts! Another feature I am looking for is to have double-click copy the word to the X clipboard, like it does outside of Tmux.

        – joeytwiddle
        Mar 30 '16 at 3:11











      • @joeytwiddle I highly recommend github.com/NHDaly/tmux-better-mouse-mode, see my other answer

        – Steven Lu
        Jan 2 '18 at 23:54



















      • I'm now just sort of toying with the idea of making mousewheel on pane border do something interesting. Probably what I'll do is not map wheel on border but map it to cycle the tmux windows when done over the statusline.

        – Steven Lu
        Dec 15 '15 at 23:53











      • What's the link to your Github? I'd like to keep abreast of your efforts! Another feature I am looking for is to have double-click copy the word to the X clipboard, like it does outside of Tmux.

        – joeytwiddle
        Mar 30 '16 at 3:11











      • @joeytwiddle I highly recommend github.com/NHDaly/tmux-better-mouse-mode, see my other answer

        – Steven Lu
        Jan 2 '18 at 23:54

















      I'm now just sort of toying with the idea of making mousewheel on pane border do something interesting. Probably what I'll do is not map wheel on border but map it to cycle the tmux windows when done over the statusline.

      – Steven Lu
      Dec 15 '15 at 23:53





      I'm now just sort of toying with the idea of making mousewheel on pane border do something interesting. Probably what I'll do is not map wheel on border but map it to cycle the tmux windows when done over the statusline.

      – Steven Lu
      Dec 15 '15 at 23:53













      What's the link to your Github? I'd like to keep abreast of your efforts! Another feature I am looking for is to have double-click copy the word to the X clipboard, like it does outside of Tmux.

      – joeytwiddle
      Mar 30 '16 at 3:11





      What's the link to your Github? I'd like to keep abreast of your efforts! Another feature I am looking for is to have double-click copy the word to the X clipboard, like it does outside of Tmux.

      – joeytwiddle
      Mar 30 '16 at 3:11













      @joeytwiddle I highly recommend github.com/NHDaly/tmux-better-mouse-mode, see my other answer

      – Steven Lu
      Jan 2 '18 at 23:54





      @joeytwiddle I highly recommend github.com/NHDaly/tmux-better-mouse-mode, see my other answer

      – Steven Lu
      Jan 2 '18 at 23:54











      3














      Gnome-terminal does some neat trickery translating mouse scroll events to Up and Down arrow keys in conditions of restricted "usual" scrolling. For example, when you view some text using less (this happens in particular when you're reading a man), you can scroll the content using j, k, and arrow keys. But also, with gnome-terminal, you can do that with mouse scrolling, thanks to the mentioned trick.



      So I guess tmux does some "capturing" of the terminal just like less - and the same mechanism in gnome-terminal kicks in: mouse scrolling translates into Up/Down arrow key presses.



      You can turn this feature off in profile settings and get the regular scrolling in any circumstances. Just unmark the last checkbox in the "scrolling" tab: the checkbox.






      share|improve this answer


























      • Thank you for explanation, uldtko! But it doesn't help with the mouse scrolling problem. Yes, with the option turned off, gnome-terminal stops sending triple ^[[A and ^[[B on mouse-scroll. It's nicer in tmux (no ugly ^[[A^[[A^[[A in some programs, no ugly command-history-scrolling), but now less stops scrolling on mouse-scroll.

        – user31494
        Dec 27 '10 at 14:48








      • 1





        Ukranian? (guessing by the i characters)

        – dotancohen
        Apr 18 '13 at 11:17
















      3














      Gnome-terminal does some neat trickery translating mouse scroll events to Up and Down arrow keys in conditions of restricted "usual" scrolling. For example, when you view some text using less (this happens in particular when you're reading a man), you can scroll the content using j, k, and arrow keys. But also, with gnome-terminal, you can do that with mouse scrolling, thanks to the mentioned trick.



      So I guess tmux does some "capturing" of the terminal just like less - and the same mechanism in gnome-terminal kicks in: mouse scrolling translates into Up/Down arrow key presses.



      You can turn this feature off in profile settings and get the regular scrolling in any circumstances. Just unmark the last checkbox in the "scrolling" tab: the checkbox.






      share|improve this answer


























      • Thank you for explanation, uldtko! But it doesn't help with the mouse scrolling problem. Yes, with the option turned off, gnome-terminal stops sending triple ^[[A and ^[[B on mouse-scroll. It's nicer in tmux (no ugly ^[[A^[[A^[[A in some programs, no ugly command-history-scrolling), but now less stops scrolling on mouse-scroll.

        – user31494
        Dec 27 '10 at 14:48








      • 1





        Ukranian? (guessing by the i characters)

        – dotancohen
        Apr 18 '13 at 11:17














      3












      3








      3







      Gnome-terminal does some neat trickery translating mouse scroll events to Up and Down arrow keys in conditions of restricted "usual" scrolling. For example, when you view some text using less (this happens in particular when you're reading a man), you can scroll the content using j, k, and arrow keys. But also, with gnome-terminal, you can do that with mouse scrolling, thanks to the mentioned trick.



      So I guess tmux does some "capturing" of the terminal just like less - and the same mechanism in gnome-terminal kicks in: mouse scrolling translates into Up/Down arrow key presses.



      You can turn this feature off in profile settings and get the regular scrolling in any circumstances. Just unmark the last checkbox in the "scrolling" tab: the checkbox.






      share|improve this answer















      Gnome-terminal does some neat trickery translating mouse scroll events to Up and Down arrow keys in conditions of restricted "usual" scrolling. For example, when you view some text using less (this happens in particular when you're reading a man), you can scroll the content using j, k, and arrow keys. But also, with gnome-terminal, you can do that with mouse scrolling, thanks to the mentioned trick.



      So I guess tmux does some "capturing" of the terminal just like less - and the same mechanism in gnome-terminal kicks in: mouse scrolling translates into Up/Down arrow key presses.



      You can turn this feature off in profile settings and get the regular scrolling in any circumstances. Just unmark the last checkbox in the "scrolling" tab: the checkbox.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jan 26 '11 at 23:45

























      answered Dec 7 '10 at 7:03









      ulidtkoulidtko

      2,1041718




      2,1041718













      • Thank you for explanation, uldtko! But it doesn't help with the mouse scrolling problem. Yes, with the option turned off, gnome-terminal stops sending triple ^[[A and ^[[B on mouse-scroll. It's nicer in tmux (no ugly ^[[A^[[A^[[A in some programs, no ugly command-history-scrolling), but now less stops scrolling on mouse-scroll.

        – user31494
        Dec 27 '10 at 14:48








      • 1





        Ukranian? (guessing by the i characters)

        – dotancohen
        Apr 18 '13 at 11:17



















      • Thank you for explanation, uldtko! But it doesn't help with the mouse scrolling problem. Yes, with the option turned off, gnome-terminal stops sending triple ^[[A and ^[[B on mouse-scroll. It's nicer in tmux (no ugly ^[[A^[[A^[[A in some programs, no ugly command-history-scrolling), but now less stops scrolling on mouse-scroll.

        – user31494
        Dec 27 '10 at 14:48








      • 1





        Ukranian? (guessing by the i characters)

        – dotancohen
        Apr 18 '13 at 11:17

















      Thank you for explanation, uldtko! But it doesn't help with the mouse scrolling problem. Yes, with the option turned off, gnome-terminal stops sending triple ^[[A and ^[[B on mouse-scroll. It's nicer in tmux (no ugly ^[[A^[[A^[[A in some programs, no ugly command-history-scrolling), but now less stops scrolling on mouse-scroll.

      – user31494
      Dec 27 '10 at 14:48







      Thank you for explanation, uldtko! But it doesn't help with the mouse scrolling problem. Yes, with the option turned off, gnome-terminal stops sending triple ^[[A and ^[[B on mouse-scroll. It's nicer in tmux (no ugly ^[[A^[[A^[[A in some programs, no ugly command-history-scrolling), but now less stops scrolling on mouse-scroll.

      – user31494
      Dec 27 '10 at 14:48






      1




      1





      Ukranian? (guessing by the i characters)

      – dotancohen
      Apr 18 '13 at 11:17





      Ukranian? (guessing by the i characters)

      – dotancohen
      Apr 18 '13 at 11:17











      1














      https://github.com/NHDaly/tmux-better-mouse-mode



      Configurable and feature-rich implementation of mouse control for newer tmuxes. highly recommended.



      You likely want to use



      set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"


      with it also.






      share|improve this answer


























      • I installed this but am no longer able to highlight and copy text with the mouse. Are you able to do this?

        – jonathanking
        Jan 11 at 18:03











      • Yes you likely have other mouse related tmux config present that conflicts with it.

        – Steven Lu
        Jan 11 at 22:02
















      1














      https://github.com/NHDaly/tmux-better-mouse-mode



      Configurable and feature-rich implementation of mouse control for newer tmuxes. highly recommended.



      You likely want to use



      set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"


      with it also.






      share|improve this answer


























      • I installed this but am no longer able to highlight and copy text with the mouse. Are you able to do this?

        – jonathanking
        Jan 11 at 18:03











      • Yes you likely have other mouse related tmux config present that conflicts with it.

        – Steven Lu
        Jan 11 at 22:02














      1












      1








      1







      https://github.com/NHDaly/tmux-better-mouse-mode



      Configurable and feature-rich implementation of mouse control for newer tmuxes. highly recommended.



      You likely want to use



      set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"


      with it also.






      share|improve this answer















      https://github.com/NHDaly/tmux-better-mouse-mode



      Configurable and feature-rich implementation of mouse control for newer tmuxes. highly recommended.



      You likely want to use



      set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"


      with it also.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jan 2 '18 at 23:53

























      answered Jan 2 '18 at 23:48









      Steven LuSteven Lu

      1,55312435




      1,55312435













      • I installed this but am no longer able to highlight and copy text with the mouse. Are you able to do this?

        – jonathanking
        Jan 11 at 18:03











      • Yes you likely have other mouse related tmux config present that conflicts with it.

        – Steven Lu
        Jan 11 at 22:02



















      • I installed this but am no longer able to highlight and copy text with the mouse. Are you able to do this?

        – jonathanking
        Jan 11 at 18:03











      • Yes you likely have other mouse related tmux config present that conflicts with it.

        – Steven Lu
        Jan 11 at 22:02

















      I installed this but am no longer able to highlight and copy text with the mouse. Are you able to do this?

      – jonathanking
      Jan 11 at 18:03





      I installed this but am no longer able to highlight and copy text with the mouse. Are you able to do this?

      – jonathanking
      Jan 11 at 18:03













      Yes you likely have other mouse related tmux config present that conflicts with it.

      – Steven Lu
      Jan 11 at 22:02





      Yes you likely have other mouse related tmux config present that conflicts with it.

      – Steven Lu
      Jan 11 at 22:02











      0














      You can combine the binding ideas from the other answers to get a pretty satisfying scrolling behavior:
      works in vim
      changes to copy mode automatically in terminal and exits it when you reach the bottom
      still allows you to use your mousewheel in man, less and journalctl.



      My code:



      bind -n WheelUpPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Up Up Up Up"  "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"
      bind -n WheelDownPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Down Down Down Down" "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"


      you can add other commands that require arrow keys for scrolling in the grep -e 'man' part



      i added the send-keys multiple times, so one tick on the mousewheel will scroll 4 lines at a time






      share|improve this answer




























        0














        You can combine the binding ideas from the other answers to get a pretty satisfying scrolling behavior:
        works in vim
        changes to copy mode automatically in terminal and exits it when you reach the bottom
        still allows you to use your mousewheel in man, less and journalctl.



        My code:



        bind -n WheelUpPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Up Up Up Up"  "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"
        bind -n WheelDownPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Down Down Down Down" "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"


        you can add other commands that require arrow keys for scrolling in the grep -e 'man' part



        i added the send-keys multiple times, so one tick on the mousewheel will scroll 4 lines at a time






        share|improve this answer


























          0












          0








          0







          You can combine the binding ideas from the other answers to get a pretty satisfying scrolling behavior:
          works in vim
          changes to copy mode automatically in terminal and exits it when you reach the bottom
          still allows you to use your mousewheel in man, less and journalctl.



          My code:



          bind -n WheelUpPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Up Up Up Up"  "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"
          bind -n WheelDownPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Down Down Down Down" "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"


          you can add other commands that require arrow keys for scrolling in the grep -e 'man' part



          i added the send-keys multiple times, so one tick on the mousewheel will scroll 4 lines at a time






          share|improve this answer













          You can combine the binding ideas from the other answers to get a pretty satisfying scrolling behavior:
          works in vim
          changes to copy mode automatically in terminal and exits it when you reach the bottom
          still allows you to use your mousewheel in man, less and journalctl.



          My code:



          bind -n WheelUpPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Up Up Up Up"  "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"
          bind -n WheelDownPane if -t = "test $(echo #{pane_current_command} |grep -e 'man' -e 'less' -e 'journalctl')" "select-pane -t = ; send-keys Down Down Down Down" "if-shell -F -t = '#{?mouse_any_flag,1,#{pane_in_mode}}' 'send-keys -M' 'select-pane -t = ; copy-mode -e; send-keys -M'"


          you can add other commands that require arrow keys for scrolling in the grep -e 'man' part



          i added the send-keys multiple times, so one tick on the mousewheel will scroll 4 lines at a time







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 12 '18 at 23:02









          stealzstealz

          1




          1























              0














              If you are already in a tmux session you can run the command



              set mouse on


              Reminder: to run commands, use your prefix then :.






              share|improve this answer




























                0














                If you are already in a tmux session you can run the command



                set mouse on


                Reminder: to run commands, use your prefix then :.






                share|improve this answer


























                  0












                  0








                  0







                  If you are already in a tmux session you can run the command



                  set mouse on


                  Reminder: to run commands, use your prefix then :.






                  share|improve this answer













                  If you are already in a tmux session you can run the command



                  set mouse on


                  Reminder: to run commands, use your prefix then :.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 11 hours ago









                  RobertRobert

                  1143




                  1143






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f210125%2fscroll-shell-output-with-mouse-in-tmux%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

                      Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

                      looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...