Sublime Forum

Scroll on up/down if caret near top/bottom of window

#1

There was a feature in a text editor I used to use (I think it was Brief) that selectively scrolled if the caret was near the top or bottom of the window. I’ll try and explain how it worked:

Effectively the window was split into top, middle and bottom areas. If [UpArrow] was pressed whilst in the top area or [DownArrow] was pressed whilst in the bottom area the text would scroll, moving the caret to the appropriate line but leaving it on the same window row. If the caret was near the top or the bottom of the buffer, preventing the text from scrolling, the behaviour would revert to normal behaviour. The top and bottom areas were the same size, but their size as a proportion of the overall window was configurable.

The advantage of this behaviour is that it allows the user to scroll up and down and still see the active line’s context, both above and below.

I have not found such a feature in ST. If others believe this would be useful, then it would be great to see it added.

0 Likes

#2

I seem to recall there was a similar vim feature that someone had ported to Sublime Text 2, but I can’t remember what it was called.

If what you’re talking about hasn’t been done already, it should be doable via a plugin.

0 Likes

#3

How easy is it to develop a plugin?

0 Likes

#4

I’d say not very. Plugins are written in Python and the API is here:
sublimetext.com/docs/3/api_reference.html

This forum is a great place to ask questions about plugin dev. I’m rather useless at this sort of thing, though I have written and maintain one plugin, chiefly because I couldn’t cajole anyone to care about the specific feature. That I’ve done so is a testament to the patience of the forum regulars :smile:

BTW, here’s the plugin I couldn’t remember earlier:
sublime.wbond.net/packages/ScrollOffset

It looks like it hasn’t been updated for ST3, but it may serve as starting point.

0 Likes