Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Scrolling in vim with urxvt
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
miscsubbin
n00b
n00b


Joined: 10 May 2012
Posts: 46

PostPosted: Fri Sep 07, 2012 12:47 am    Post subject: Scrolling in vim with urxvt Reply with quote

One of the things I miss from a GUI text editor is the ability to use the mouse to scroll and select things. In urxvt you can use the scroll wheel to see previous commands and outputs (I think this is called the buffer? Not sure). I would also like to be able to scroll in vim, but every time I attempt to scroll it simply scrolls backwards in the buffer and I see previous commands. I would like to be able to scroll in the file. Is there a way I can do this?

I figure I could disable the scrolling through the buffer all together and just have scrolling send a command to press up or down in the terminal, but then I lose the ability to scroll backwards in the buffer. Is it possible to retain both features? Is there a way for urxvt to be able to determine the current program running?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri Sep 07, 2012 12:10 pm    Post subject: Reply with quote

miscsubbin ...

Not to deter you from finding a way of doing this but I think your transplanting a 'mouse' (and all that this paradigm implies) into an enviroment where this paradigm is mostly meaningless. Its like using an umbrella while deep sea diving, sure you can do it, but its not keeping the rain off your back, and in other regards it may be considered a hindrance.

There are all kinds of methods vim provides for navigation within a document, and if these are not entirely to you liking there is gvim, with its menus, scrollbar, etc, etc ... just as it is in a gui.

The very idea that I would take my hands from the keyboard and reach for a mouse to do anything within vim causes me to get shivers, the very reason I use vim is so that the keyboard is the input device, and this offers far more than a pointing/scrolling device.

If you have certain expectations in that regard then this is partly due to the disconnect that happens when having to inhabit a terrain different from the flatland offered by gui's. Getting use to navigation via the keyboard takes both a change in mindset and some effort, but like any skill its only aquired by doing/practice/etc. Once aquired you'll wonder how you managed to get anything done with a mouse ... but anyhow, thats somewhat of a digression.

So, with rxvt-unicode (and the 'mousewheel' useflag enabled) urxvt will interpret any scroll as intended for it, and not the particular appliction running within it. It may be possible to override this with a keypress of some sort, but by default it'll take the mouse input as intented for the terminal. You might look at :help xterm-mouse-wheel and :help scroll-mouse-wheel for some idea of what you would need to provided to have vim accept mousewheel events (and no doubt these would need to be modified to account for the fact the urxvt is grabbing the scrollwheel input by default, perhaps some meta key can be used to override this).

Otherwise, you should look at :help naivgation and :help search. The simplist solution is perhaps: 'ctrl-b', 'ctrl-f', g <num>, etc.

best ... khay
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Fri Sep 07, 2012 3:49 pm    Post subject: Re: Scrolling in vim with urxvt Reply with quote

miscsubbin wrote:
One of the things I miss from a GUI text editor is the ability to use the mouse to scroll and select things. In urxvt you can use the scroll wheel to see previous commands and outputs (I think this is called the buffer? Not sure). I would also like to be able to scroll in vim, but every time I attempt to scroll it simply scrolls backwards in the buffer and I see previous commands. I would like to be able to scroll in the file. Is there a way I can do this?

I figure I could disable the scrolling through the buffer all together and just have scrolling send a command to press up or down in the terminal, but then I lose the ability to scroll backwards in the buffer. Is it possible to retain both features? Is there a way for urxvt to be able to determine the current program running?
Code:
:set mouse=a
:D
_________________
emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/
Back to top
View user's profile Send private message
miscsubbin
n00b
n00b


Joined: 10 May 2012
Posts: 46

PostPosted: Fri Sep 07, 2012 9:35 pm    Post subject: Reply with quote

khayyam wrote:
miscsubbin ...

Not to deter you from finding a way of doing this but I think your transplanting a 'mouse' (and all that this paradigm implies) into an enviroment where this paradigm is mostly meaningless. Its like using an umbrella while deep sea diving, sure you can do it, but its not keeping the rain off your back, and in other regards it may be considered a hindrance.

There are all kinds of methods vim provides for navigation within a document, and if these are not entirely to you liking there is gvim, with its menus, scrollbar, etc, etc ... just as it is in a gui.

The very idea that I would take my hands from the keyboard and reach for a mouse to do anything within vim causes me to get shivers, the very reason I use vim is so that the keyboard is the input device, and this offers far more than a pointing/scrolling device.

If you have certain expectations in that regard then this is partly due to the disconnect that happens when having to inhabit a terrain different from the flatland offered by gui's. Getting use to navigation via the keyboard takes both a change in mindset and some effort, but like any skill its only aquired by doing/practice/etc. Once aquired you'll wonder how you managed to get anything done with a mouse ... but anyhow, thats somewhat of a digression.

So, with rxvt-unicode (and the 'mousewheel' useflag enabled) urxvt will interpret any scroll as intended for it, and not the particular appliction running within it. It may be possible to override this with a keypress of some sort, but by default it'll take the mouse input as intented for the terminal. You might look at :help xterm-mouse-wheel and :help scroll-mouse-wheel for some idea of what you would need to provided to have vim accept mousewheel events (and no doubt these would need to be modified to account for the fact the urxvt is grabbing the scrollwheel input by default, perhaps some meta key can be used to override this).

Otherwise, you should look at :help naivgation and :help search. The simplist solution is perhaps: 'ctrl-b', 'ctrl-f', g <num>, etc.

best ... khay


Guess I'll try to do more keyboard work, but it just seems slow in comparison, even when you have to take into account the fact that I have to move my hand all the way over to the mouse and back every time.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum