Mausrad scrollen in weniger und vim mit urxvt

7222
Adam Batkin

Ich habe angefangen, mit rxvt-unicode (aka urxvt) zu arbeiten, habe aber ein Problem mit dem Scrollen der Mausräder im Vergleich zu gnome-terminalund festgestellt konsole. Das Mausrad funktioniert gut, um durch den Scrollback-Puffer zu gehen, aber es funktioniert nicht für das automatische Scrollen in less/ mostoder vim(obwohl in Vim die Einstellung mouse=afunktioniert, aber auf eine ganz andere Art und Weise, was ich nicht zu tun habe gnome-terminal/ konsole).

Gibt es eine Möglichkeit, sich so zu urxvtverhalten wie gnome-terminalund konsolewann lessund vimwo das Mausrad gerade funktioniert?

16
Eine ähnliche Frage wurde schon eine Weile auf Serverfault gestellt, erhielt jedoch keine positive Antwort: http://serverfault.com/questions/10308/enable-mousewheel-scrolling-in-rxvt-under-cygwin nidi vor 14 Jahren 0
Danke, das hat mich nicht geärgert, bis Sie darauf hingewiesen haben! Kyle Smith vor 12 Jahren 1

3 Antworten auf die Frage

8
jjacky

Old question, but: while this is not possible in urxvt, I made some changes that will add an option (secondaryWheel) to do exactly that, and make it behave like VTE-based terminals.

What this new option does, is pretty simple: when using the mouse wheel, if you’re on secondary screen(*) then no scrolling will occur, and instead 3 “fake” keystrokes will be sent to the running application. So, a wheel up will have the same result as pressing the Up key three times, and wheel down will do the same as pressing 3 times the Down key.

(*) not sure whether this is the “official” term or not, but at least that’s how it’s called in urxvt.

Easy enough, but that does the trick: now when running man, less or any other application that uses the secondary screen, you can use the mouse wheel to move around (or whatever said application would do, if you pressed the Up/Down keys).

It should be noted that I'm not sure this is actually how things are done in VTE-based terminals - I never checked - but this does the job, so it works for me.

A little more info, and links to the code & PKGBUILD for Arch Linux can be found there: http://mywaytoarch.tumblr.com/post/14455320734/scrolling-mouse-wheel-improvments-vte-like-in-urxvt

Hopefully this can be helpful to some!

Gibt es Updates zum Patch? Ist es zur Aufnahme vorgeschlagen worden? blueyed vor 9 Jahren 1
1
Clara

Ich habe dies für eine sehr ähnliche Frage geschrieben, siehe https://superuser.com/a/1356948/900060

Fügen Sie dies in $ HOME / .urxvt / ext / vtwheel ein (erstellen Sie die Datei, falls sie nicht vorhanden ist):

#! perl  # Implements a scrollwheel just like in good old vt100's mices  sub simulate_keypress { my ($self, $type) = @_; #type: 0:up, 1:down  my $keycode_up = 111; my $keycode_down = 116;  my $numlines = 3;  my $keycode = 0; if ($type eq 0) { $keycode = $keycode_up; } elsif ($type eq 1) { $keycode = $keycode_down; } else { return; }  for (my $i = 0 ; $i ne $numlines ; $i++) { $self->key_press(0,$keycode); $self->key_release(0,$keycode); } }  sub on_button_release { my ($self, $event) = @_;  #my $res_ss = $self->resource("secondaryScroll"); #warn("ressource ss is <$res_ss>");  !$self->current_screen and return ();  #warn("foo, event: <$event->>\n"); if ($event-> eq "4") { # scroll up $self->simulate_keypress(0); return 1; } elsif ($event-> eq "5") { # scroll down $self->simulate_keypress(1); return 1; }  return (); } 

Dann füge sie URxvt.perl-ext-common:vtewheelzu .Xresources(oder .Xdefaults) hinzu und rennexrdb .Xresources

Quelle: https://aur.archlinux.org/cgit/aur.git/tree/vtwheel?h=urxvt-vtwheel

0
dvd

Gute Frage! Einige nützliche Beiträge zitiere ich Linux-Frage - "weniger" Befehlsausgabe - ich kann nicht durchblättern! und Archlinux Forum - Verwenden Sie Mouse Wheel in man / less .

Es scheint, als würden weniger nur Tastaturereignisse hören und keine Maus unterstützen. Die Verzauberungsanforderung für die Mausunterstützung ist offen Ref. 272 .

Die eigentliche Lösung ist die Verwendung eines anderen Terminals oder Pagers ( Vimpager ).