Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2: How to Page Up/Down without moving the cursor

I'm on OS X 10.8.4 using ST2. When I use the Home and End keys, the viewport moves and the cursor is left alone. This is standard Mac behavior, and what I'd expect.

However, when I use Page Up (pageup/pgup) and Page Down (pagedown/pgdn), the cursor moves along with the viewport. This is not how other Mac apps behave, and I'd like the cursor to be left alone for these keys too.

I've been able to get this half-working by adding this to my key bindings:

[
   { "keys": ["pageup"], "command": "scroll_lines", "args" : {"amount": 30.0} },
   { "keys": ["pagedown"], "command": "scroll_lines", "args" : {"amount": -30.0} }
]

However, the amounts there are hard-coded. It looks like viewport_extent will get me the height of the viewport, but how can I use that from within the key bindings file? Is this even the correct solution for this? I feel like it's an awful lot of work to go to to get this behavior.

Thanks in advance.

like image 799
Nick K9 Avatar asked Jun 20 '13 13:06

Nick K9


1 Answers

Just using Fn+up to pageup and Fn+down to pagedown.

like image 77
Eric Guo Avatar answered Oct 07 '22 18:10

Eric Guo