vim under screen under PuTTY working with mouse wheel?

7,784

Solution 1

Scrolling with the mouse wheel in Vim under PuTTY over an ssh connection works for me if I have executed this:

:set mouse=a

Tested with tmux, screen and no screen multiplexer.

Edit

As requested, here is the ~/.screenrc from the machine I used for testing.

startup_message off
vbell off
bell_msg 'Bell in window %n^G'
defscrollback 500
hardstatus off
altscreen on

Solution 2

This seems to be a common problem affecting both screen and tmux when accessed using PuTTY. Please see my answer to a similar question pertaining to tmux for some insight into the issue itself. There is a potential solution provided as well as some analysis.

Mouse scrolling in vim through tmux, how to configure?


An excerpt of the link above describing the potential solution:

Potential Solution -- PuTTY

There appears to be an issue where PuTTY sends an extraneous ScrollDown event with every ScrollDown/ScrollUp event. This means that each attempt to scroll up gets cancelled out and nothing happens. Conversely, when scrolling down, each scroll event is doubled. The behavior is easy to validate by looking at the vim scrolling behavior first outside of tmux (where scrolling works properly), and second inside of tmux (where scrolling up does not work, and a single attempt to scroll down scrolls twice as much).

According to the following gmane thread, the issue described above is resolved with a patch from Putty-X (https://github.com/atsepkov/putty-X/commit/bbcedf5a85ca1ccaa27005e7f7ebeb4c8a783b88):

Link to gmane thread: http://comments.gmane.org/gmane.comp.terminal-emulators.tmux.user/5498.

NOTE: I haven't validated the above solution myself, so please review the gmane thread for additional information.

Share:
7,784

Related videos on Youtube

gcb
Author by

gcb

Updated on September 18, 2022

Comments

  • gcb
    gcb over 1 year

    Is there any way to make this work?

    i'd love to scroll my files in vim with the mouse scroll wheel.

    Also, i wouldn't mind scrolling the gnu screen buffer with the mouse wheel as well, without having to type ctrl+a,ESC

    Edit:

    as mentioned in Isaac Rabinovitch's answers, the screen and vim settings are already fine. I think the whole issue resides in PuTTY alone.

  • gcb
    gcb about 11 years
    wait, here it works with plain putty->vim. but with putty->screen->vim it does not work. it scrolls the putty scroll back when i'm under screen. can you paste your screenrc?
  • gcb
    gcb about 11 years
    i do that for seeing larger diffs on meld, but using vim over ssh is already too slow for me (and the machines have a 80ms ping). i think gvim over X would kill me. I use Xming as well.
  • gcb
    gcb about 11 years
    thanks. mine is way more complex than that, but even with this basic one it still does not work :/ will probably end up giving tmux a try
  • Heptite
    Heptite about 10 years
    This is basically a link-only answer, which is not the preferred answer format for superuser. Can you summarize the steps here? Leaving the link is okay.
  • Mr. Llama
    Mr. Llama about 7 years
    As of PuTTY 0.67 (it may have been fixed earlier) this doesn't seem to be an issue anymore.
  • L__
    L__ over 5 years
    +1 It's kinda slow most of the time - but noice