Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My main complain about tmux is that it messes with my terminal emulator scroll buffer. I like to use a mouse to scroll my terminal emulator. For example I can do `cat file` and then scroll around. If file is huge, `less` is better, of course, but for most things terminal scrolling is perfect. But `tmux` and `screen` completely ruin that experience. I know that they have their own scrollbuffer and scroll mode and all that, but I've found that perfect user experience for me is to blend GUI approach and text mode approach instead of replacing it.


I have my tmux set up as you describe, it's easy to do.

In newer versions of tmux, you just add 'set -g mouse on' to your ~/.tmux.conf. I also have copy mode set to use vi keybindings, and I can yank to the system clipboard.


It doesn't seem to be as simple for cross platform support, I have had to use different settings for Linux and OSX


Care to share those settings?


Thanks, I'll look into it.


Here's my ~/.tmux.conf if you're interested:

https://github.com/rhinoceraptor/dotfiles/blob/master/tmux/....


+1. Scrollback used to be one of my gripes as well, but it now works well under tmux.

I like to have a single key binding to toggle mouse on/off, so I found a clever (although hacky) way reading someone's .tmux.conf, and have used it ever since:

  # toggle mouse
  bind m run "cut -c3- ~/.tmux.conf | sh -s toggle_mouse"

  # toggle_mouse() {
  #   old=$(tmux show -g -w | grep mode-mouse | cut -d' ' -f2)
  #   new=""
  #
  #   if [ "$old" = "on" ] ; then
  #     new="off"
  #   else
  #     new="on"
  #   fi
  #
  #   tmux set -g mode-mouse $new \;\
  #        set -g mouse-resize-pane $new \;\
  #        set -g mouse-select-pane $new \;\
  #        set -g mouse-select-window $new \;\
  #        display "mouse: $new"
  # }


This is completely fixed by using iTerm2 in control mode. You'll get native tabs/Windows and native scroll back along with native keys.


"C-b [" will allow you to move the cursor, then you'll be able to use the arrow keys to move around, or M-v and C-v for page up/down.


*This keybinding works only for the latest versions. Not sure exactly from which version onwards. Mine is v2.1.

Before I upgraded to v2.1, both keybinding and its behaviour was different.


This, I use this all the time with emacs binding and I don't see the problem with scrolling.


Amazingly, the problem of mouse scrolling in screen sessions can usually be addressed with a line in your .screenrc file to set the termcapinfo. eg:

    termcapinfo xterm ti@:te@
See:

https://www.mattcutts.com/blog/screen-power-tips-screenrc/

It took me years to find this out!


I don't find <prefix>-PgUp a lot harder than Shift-PgUp. The tmux buffer also has the benefit that you can search, copy, write to file and more.

Oh, and I think tmux' "mouse on" lets you wheel-scroll the buffer, although I haven't used it.




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

Search: