Is there a Visual Studio equivalent of Vim scrolloff or Emacs scroll-margin?
Asked Answered
I

5

16

Is there a standard option built into Visual Studio to act like the Vim scrolloff option or the Emacs scroll-margin option?

The aim is for Visual Studio to always show at least x lines above and below the current point.

Injustice answered 12/8, 2010 at 17:48 Comment(2)
This is not an answer, but a suggestion. I am using a Vim emulator extension in visual studio called VsVim. github.com/jaredpar/VsVim I tried setting the scrolloff, and it didn't work, but according to the author of the plugging, if you request a feature, he may implement it. Could there be an emacs emulator that does implement scroll-margin? Maybe.Tetrabranchiate
@HugoEstrada he implemented it :) I instinctively set the option and was shocked at it working.Crass
B
3

If you hold control when you use the arrow key for up/down, it'll scroll the text up/down without moving the cursor.

Also, there is a command called Edit.ScrollLineCenter which you can search for under tools/options/environment/keyboard & assign a hotkey to it.

Bobsledding answered 14/7, 2011 at 4:47 Comment(0)
D
1

I only know of the "Split View" feature in Visual Studio

As in http://msdn.microsoft.com/en-us/library/z01zks9a(v=vs.71).aspx it says:

Splitting the View

A Code Editor can be split into two separate parts for easier editing.

To split a pane

  1. Click the splitter bar (located above the scroll bar).
  2. Drag the splitter bar downward.
  3. To go back to a single pane, double-click the splitter bar dividing the two panes.

The new pane contains the same document, and any changes made to it are reflected in the other pane as long as that pane displays the same place in the document.

You can additionaly open a file in a new window (Menu Window>New Window) and dock it next to the original window to view additional different parts of that file simultaneously as in http://msdn.microsoft.com/en-us/library/z4y0hsax(v=VS.90).aspx

Tiling Document Windows

If you want to view more than one document at a time while editing code, you can tile the document windows.

To tile document windows

If the IDE is running in Tabbed documents mode, select a tab and drag it below or above the current document tile. A rectangular outline appears in the location where the new document tile will be placed.

Some screenshots for both options: http://www.kevinwilliampang.com/2008/08/19/visual-studio-tip-split-views/

Update:

Does navigating with Ctrl+ / Ctrl+ inside the editor window help you?

Disserve answered 7/6, 2011 at 12:9 Comment(1)
Very useful, but unfortunately not what we are looking for. With VI's behaviour you always get context around the cursor, without having to do anything else.Lundeen
L
1

You can add editor.cursorSurroundingLines to your settings.json

e.g

"editor.cursorSurroundingLines": 8,
Loveland answered 18/1, 2022 at 22:20 Comment(0)
M
0

In short: No there isn't.

Longer: No there isn't any that I am aware of. But there should be. Search the extensions and please report back.

Megadeath answered 18/7, 2011 at 21:49 Comment(0)
V
0

Way old answer, but anyway: there's an option now. Open UI Settings and search for Cursor Surrounding Lines. That's exactly what vim's scrolloff is.

Venetic answered 8/4, 2021 at 10:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.