View mode movement

Do any of you use view mode to move the screen?
I almost never use it, since the mouse scroll wheel is just so much more effective.
So, I’m wondering what you all have been doing to make screen movement easier.

One thing that would help, is if I could make view::[hjkl] move by multiple lines per press instead of just one at a time. Do you know how to do this?

To me, view mode is useless, because it doesn’t allow to move past the cursor, and doesn’t move cursor if you try to move past it. Which locks you to your cursor position plus the amount of lines that can fit on screen before and after it. If you start view mode in the initial position (0,0) it is pretty much useless, because you can’t move neither down or right.

But I use view mode, because I’ve binded select-view command in that menu. So vs selects entire view for me. It also bound to Alt+%, though it’s harder to use.

I also rely on view-mode programmatically to center view after successful search or jump in my plugins.

hm, select-view is a good idea, I’ll check that out.

I agree, view mode as it is, is pretty much useless. It would be much more helpful if it behaved like the mouse scroll-wheel.
This is what I’d change to make it better:

  • Each hjkl press moves multiple lines (5 or so)
  • View mode (lock) hjkl does “smooth scrolling”. That is: it has no delay before rapid key press. Normally when you press a key and hold it, one keypress is sent, then a small delay, before multiple, rapid presses are sent. But, I’ve seen some applications (such as Vimium) manage to eliminate this delay, so scrolling via key-press is smooth. IDK if this would be possible with ncurses.
  • scrolling doesn’t move cursor or selections, and primary selection can go off-screen. This wouldn’t be a problem, since you could just focus the primary selection again using vc, or any keys other than view-mode would also focus the primary selection.
  • A new key to temporarily move the view to a different location in the jump-list, without moving the cursor.

But, I’m not sure how to make these changes.

We have discussed it with @occivink but never implemented.

The idea is to allow scrolling past the main cursor by using highlighters to visualize the selections and restoring them (selections and view) when leaving the view mode.

Removing the single v, moving V (lock) to v, and adding a bunch of commands, such as g / G, Page Down / Page Up and mouse bindings.

@mawww What do you think to allow scrolling past the main cursor in the view mode?

@FlyingWombat In my web extension I allow the main selection to be off-screen and have Control + Space to focus it. The difference between Vimium and Kakoune is that the navigation keys are about scrolling in web browsers and moving the selections in Kakoune.

The interesting part is what would happen if user would decide to move to negative space, e.g. starting in 0,0 position and moving up and left. How should Kakoune behave in that case? Should it restrict the movement here or create a padding around a buffer?

Finally implemented it.

3 Likes