Method to scroll the view, centered around the cursor (a single time)

Hey everyone.

So I know about the typewriter scroll plugin. It’s great but I don’t like the fact that it centers after the cursor after each keypress. I mean thats the whole point of the plugin, I get that. But I’m working a lot with lists in which i often jump around a lot to edit stuff and the constant re-centering can get very disorienting. I do like to be able to center the view around the cursor without using the mouse though. But only on command. Preferably through a hotkey. I’ve looked but I couldnt find any plugins providing this functionality.

A workaround for the moment for me is the “Zoom Out” command from the Zoom plugin, which when zoomed out already centers the view around cursor. But now I can’t use that command when zoomed in, as it will zoom out.

Maybe someone else had the same problem and found a solution :slight_smile:

Thanks everyone :slight_smile:

Does the Typewriter plugin have any commands to turn it on and off? (Open the command palette and type “typewriter”.)

Yes it does. Unfortunately the view is only centered after some kind of input (like caret movement).

I don’t have any solution. I just agree that it is jarring, so I don’t use it. My favourite way of centering a cursor is “scrolloff” in Vim. You set how many lines you want to keep as a margin. If you’re in the middle, you can move around freely, but if you move to the margin you’ve set, then the window scrolling follows.

(Sadly, I don’t think that setting exists in CodeMirror’s Vim keybindings.)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.