7

I am not satisfied with the scrolling behaviour in intellij for page up, page down. It doesn't feel right. It always feels as if I get out of the scope.

Is it possible to adjust the scroll size of page up, page down? Perhaps to half a page or similar.

mjs
  • 21,431
  • 31
  • 118
  • 200
  • Define "scope". What do you want to happen when you scroll/page up and down? – Makoto Dec 22 '14 at 23:08
  • Did you get anywhere with that plugin? Care to share? – Voy Aug 16 '16 at 11:03
  • No, not yet. Other plugins have been added though. This one not yet, but it is annoying me on a daily basis. Another annoyance is the way ctrl left selects words, never right. – mjs Aug 16 '16 at 11:06
  • 2
    I issued a feature request for scrolling up/down *half* a page. Please vote for it in case you miss it too: https://youtrack.jetbrains.com/issue/IDEA-175397 – Rotareti Jul 04 '17 at 22:05
  • 1
    @Rotareti Thank you! It is so annoying still, I am thinking of developing a plugin for this. It kills me everyday. – mjs Jul 05 '17 at 09:05
  • 1
    If you are on a mac you can get this behaviour globally, not just in Intellij, which is the solution i ended up with. Smooth too. – mjs Nov 06 '19 at 20:40
  • @mmm - for the mac users out there with the same problem, would you mind sharing how you got this working globally? – Aaron V Jun 23 '20 at 05:38
  • 1
    @AaronV Karabiner. Add a complex rule to scroll on pagedown instead. – mjs Jun 26 '20 at 14:05
  • 1
    @AaronV here is one for page_down ... https://hastebin.com/ ... note, i click randomly after since it is scrolling .. for global use, you do not need to click. So other rules unless bundle_identifiers. – mjs Jun 26 '20 at 14:07
  • 1
    @AaronV also recommend Mos application to smooth scroll control. – mjs Jun 26 '20 at 14:08
  • 1
    @AaronV hastebin acting up, so I added a new answer with code instead. – mjs Jun 26 '20 at 14:15

3 Answers3

5

I had taken @yole's answer and implemented all of the actions he had described in a separate plugin:

There is no way to control this through the settings. What you can do is write a plugin that performs scrolling in the way that you prefer. It's fairly easy: all you need to do is copy the existing PageUpAction/PageDownAction classes and the methods they call (EditorActionUtil.moveCaretPageUp/Down) to scroll by as much as you want.

This plugin implements new actions "Partial Page Up" and "Partial Page Down" which allow one to scroll a configurable size of screen definable in the usual IDEA settings dialog.

There's an installable version of the plugin in official JetBrains repository.

Andrey Cizov
  • 695
  • 10
  • 20
  • Great, but if you are on a mac you can get this behaviour globally, not just in Intellij, which is the solution i ended up with. Smooth too. – mjs Nov 06 '19 at 20:40
  • This should be the accepted answer, or the question should be changed to reflect that it was about changing macOS behaviour and not the Intellij development interface. As it stands the accepted answer, and intended question is more suited for: superuser.com – André C. Andersen Feb 13 '21 at 20:54
  • Unfortunately, the plugin is not working since 2022.1 :( Here is [the tracking issue with a workaround for Mac users](https://github.com/andreycizov/idea-partialnav/issues/12) – Agat May 21 '22 at 13:22
4

There is no way to control this through the settings. What you can do is write a plugin that performs scrolling in the way that you prefer. It's fairly easy: all you need to do is copy the existing PageUpAction/PageDownAction classes and the methods they call (EditorActionUtil.moveCaretPageUp/Down) to scroll by as much as you want.

yole
  • 92,896
  • 20
  • 260
  • 197
  • Thanks, I am using Intellij 14 now, how do I create a new plugin? Can't see it in the new project window. – mjs Dec 25 '14 at 11:16
  • http://confluence.jetbrains.com/display/IDEADEV/Getting+Started+with+Plugin+Development – yole Dec 26 '14 at 09:31
  • 1
    Great, thanks. I should also like to highlight another issue regarding this. When you page up up all the way up, the pointer moves to the beginning of the file. Page down then leads the pointer not being in the correct place. So if you are scrolled down a bit in the beginning of the document, and page up, look for something and then page down, you loose the place you were in. Very annoying. – mjs Dec 26 '14 at 12:07
  • @momomo Did you end up creating that plugin? I'd be interested in it ;) – WestCoastProjects Jun 30 '19 at 12:26
  • @javadba no i did not. I approached it a bit differently though. I successfully manipulated the page up/down globally on my mac to mouse scroll the size i want instead (smoothly as well!) so solved it globally rather than just for intellij. – mjs Jul 13 '19 at 09:54
  • I can definitely tell you that standard behaviour is not desired. There is no reason why it should cut of exactly half a page. I can hold down page down and it will actually kind of scroll now and increase speed. – mjs Jul 13 '19 at 09:56
  • @javadba I added a new answer for mac users. – mjs Jun 26 '20 at 14:15
1

Since many are inquiring about this, for mac users this can be controlled globally instead by instead scrolling on page up/down using karabiner application and adding the following complex rule:

{
    "description": "mmm.karabiner.page.up.down.to.scroll",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^net.java.openjdk.cmd",
                        "^com.jetbrains.intellij"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "page_up"
            },
            "to": [
                {
                    "mouse_key": {
                        "vertical_wheel": -51
                    }
                }
            ],
            "to_delayed_action": {
                "to_if_invoked": [
                    {
                        "pointing_button": "button1"
                    }
                ]
            },
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^net.java.openjdk.cmd",
                        "^com.jetbrains.intellij"
                    ],
                    "type": "frontmost_application_unless"
                }
            ],
            "from": {
                "key_code": "page_up"
            },
            "to": [
                {
                    "mouse_key": {
                        "vertical_wheel": -51
                    }
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^net.java.openjdk.cmd",
                        "^com.jetbrains.intellij"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "up_arrow",
                "modifiers": {
                    "mandatory": [
                        "fn"
                    ]
                }
            },
            "to": [
                {
                    "mouse_key": {
                        "vertical_wheel": -51
                    }
                }
            ],
            "to_delayed_action": {
                "to_if_invoked": [
                    {
                        "pointing_button": "button1"
                    }
                ]
            },
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^net.java.openjdk.cmd",
                        "^com.jetbrains.intellij"
                    ],
                    "type": "frontmost_application_unless"
                }
            ],
            "from": {
                "key_code": "up_arrow",
                "modifiers": {
                    "mandatory": [
                        "fn"
                    ]
                }
            },
            "to": [
                {
                    "mouse_key": {
                        "vertical_wheel": -51
                    }
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^net.java.openjdk.cmd",
                        "^com.jetbrains.intellij"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "page_down"
            },
            "to": [
                {
                    "mouse_key": {
                        "vertical_wheel": 51
                    }
                }
            ],
            "to_delayed_action": {
                "to_if_invoked": [
                    {
                        "pointing_button": "button1"
                    }
                ]
            },
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^net.java.openjdk.cmd",
                        "^com.jetbrains.intellij"
                    ],
                    "type": "frontmost_application_unless"
                }
            ],
            "from": {
                "key_code": "page_down"
            },
            "to": [
                {
                    "mouse_key": {
                        "vertical_wheel": 51
                    }
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^net.java.openjdk.cmd",
                        "^com.jetbrains.intellij"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "down_arrow",
                "modifiers": {
                    "mandatory": [
                        "fn"
                    ]
                }
            },
            "to": [
                {
                    "mouse_key": {
                        "vertical_wheel": 51
                    }
                }
            ],
            "to_delayed_action": {
                "to_if_invoked": [
                    {
                        "pointing_button": "button1"
                    }
                ]
            },
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^net.java.openjdk.cmd",
                        "^com.jetbrains.intellij"
                    ],
                    "type": "frontmost_application_unless"
                }
            ],
            "from": {
                "key_code": "down_arrow",
                "modifiers": {
                    "mandatory": [
                        "fn"
                    ]
                }
            },
            "to": [
                {
                    "mouse_key": {
                        "vertical_wheel": 51
                    }
                }
            ],
            "type": "basic"
        }
    ]
},

Also do note, to get smooth scrolling, consider down loading Mos application and adjust the preferences if desired.

https://mos.caldis.me/

This might have other consequences on your Mac so you might need to have to adjust other things since your page_up/down is no longer a page_up/down but mouse scrolls instead.

mjs
  • 21,431
  • 31
  • 118
  • 200