Sublime Forum

Keybinding for cursor movement

#1

I’ve been able to customize my keybindings to do nearly everything I like except one.
In old editors like BBedit and TextWrangler and even older MPW environment along with several Mac editors in the past, there was a keybinding that would do the following:
if moving up
move the cursor to the top of the viewport
if it is already at the top of the viewport, page up and place the cursor at the top of the viewport
if moving down
move the cursor to the bottom of the viewport
if it is already at the bottom of the viewport, page down and place the cursor at the bottom of the viewport

Is there an easy way to bind this to a keybinding or will I need to write a plugin?

0 Likes

#2

I would also be interested in such a feature. Unfortunately, the list i.e. here https://docs.sublimetext.io/reference/commands.html#expand-selection which is bol, eol, bof, eof, brackets for move_to; or bol, hardbol, eol, hardeol, bof, eof, brackets, line, tag, scope, indentation for expand_selection does not include a viewport option. That would be great.

0 Likes

#3

This is not directly possible via a key binding, no; what this would take is two different key bindings per motion (two for up, two for down), where one of them has a context that makes it apply when the cursor is on the top line of the viewport so that it can execute a different command.

There is no such context in core Sublime, so a plugin would be needed to include one.

0 Likes