Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Scroll Off #12048

Closed
octref opened this issue Sep 14, 2016 · 15 comments
Closed

Feature Request: Scroll Off #12048

octref opened this issue Sep 14, 2016 · 15 comments
Assignees
Labels
editor-rendering Editor rendering issues feature-request Request for new features or functionality on-testplan
Milestone

Comments

@octref
Copy link
Contributor

octref commented Sep 14, 2016

In Vim, you can set a scrolloff so it keeps at least N lines below the cursor:

scrolloff

Currently Code has a scrolloff of 1. Would be great if this is made an option.

@Bill-Stewart
Copy link

Does VS Code have a "scroll window leaving cursor in view" command? The scroll commands I see in the default keymapping all scroll the cursor out of view.

@Bill-Stewart
Copy link

The answer to my question is yes - editorScroll function can do this, but behavior is a little different than vim behavior shown in the animated GIF. I believe request is for scrollLineDown but maintain the cursor position.

@alexdima alexdima assigned sandy081 and unassigned alexdima Oct 22, 2016
@sandy081 sandy081 added editor VIM VIM issue labels Oct 24, 2016
@sandy081 sandy081 added this to the Backlog milestone Oct 24, 2016
@Chadehoc
Copy link

Chadehoc commented Jan 4, 2017

I believe request is for scrollLineDown but maintain the cursor position.

Not exactly. The feature is to scroll sooner, to always show context lines around the cursor. Currently, when moving down, scrolling ensures 1 context line left below the current line, and when moving up, none at all (scrolling does not begin until the cursor hits the top of the panel).

It is very comfortable to always keep 4 or 5 visible lines above/below the current line, after all moves that move it (next search hit, go to matching parenthesis, etc.).

This feature is called scrolloff in Vim and scroll-margin in Emacs.

@sandy081 sandy081 assigned rebornix and unassigned sandy081 Jan 5, 2017
@rebornix rebornix added the feature-request Request for new features or functionality label Apr 5, 2017
@rebornix rebornix removed their assignment Sep 5, 2017
@semanser
Copy link

semanser commented Sep 24, 2017

There is an extension vscode-scrolloff that provides similar functionality.

@octref
Copy link
Contributor Author

octref commented Nov 16, 2017

I've removed Vim label since I see Sublime also have it.
Although @semanser's extension works well, I still hope this can make it into the editor itself since it's a common feature.

soff

@octref octref removed the VIM VIM issue label Nov 16, 2017
@alexdima alexdima added editor-rendering Editor rendering issues and removed editor labels Sep 20, 2018
@xlucas
Copy link

xlucas commented May 3, 2019

So is this being considered at all? Really missing this and the extension for that misbehaves with the vim plugin.

@AndriSig
Copy link

There is an extension vscode-scrolloff that provides similar functionality.

That extension misbehaves badly when your have lines longer than your working window.

@spiffytech
Copy link

The extension also doesn't work with the Vim extension's zb / zt commands.

@CodingPapi
Copy link

Come on, we need this common feature

@rebornix rebornix modified the milestones: Backlog, August 2019 Aug 7, 2019
@rebornix
Copy link
Member

rebornix commented Aug 7, 2019

You should be able to set editor.scrollOff later this week with Insiders.

@rebornix
Copy link
Member

rebornix commented Aug 8, 2019

Considering that this feature in VS Code is slightly different from Vim's scrollOff (for example, you can scroll the viewport without moving the cursor in VS Code, which is not affected by this feature), it's being named as editor.cursorSurroundingLines.

@waldyrious
Copy link
Contributor

It's being named as editor.cursorSurroundingLines.

How does this interact with editor.scrollBeyondLastLine, if at all? I have considered requesting a change to the latter to support numeric values in addition to boolean ones (which is actually how I came across this issue), and this new setting seems to partially address the reason why I'd want that: to prevent meaningful context to be scrolled entirely out of view.

@rebornix
Copy link
Member

@waldyrious it's a different feature request #56174

@waldyrious
Copy link
Contributor

Thanks for the pointer, @rebornix. I've subscribed to that issue.

@Otiel
Copy link

Otiel commented Sep 5, 2019

@rebornix Thanks for implementing this!

@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-rendering Editor rendering issues feature-request Request for new features or functionality on-testplan
Projects
None yet
Development

No branches or pull requests