How to disable horizontal scroll in visual studio code? - scroll

When I scroll with the touch pad with two fingers in Visual Studio Code, I often scroll to the sides a little by accident. This is a bit annoying.
I'd be happy to have it scroll only up and down.

A partially satisfying solution, is to simply press Alt + z, to have the lines wrapped, and then it doesn't scroll to the side.
You can also make wordWrap default as described here How do I turn on text wrapping by default in VS Code

If you have this problem because of Gitlens (blame lines), the solution i found is to disable gitlens.currentLine.scrollable (or set it to false in the settings json file.

Pressing alt + z to disable horizontal scrolling, works fine for a current single file. If you want permanent solution then for every file you visit? then follow:
Settings > Text Editor > Diff Editor > Word Wrap to on
Note: in case you don't know where is this Settings, just go
1. Via MENU
File > Preferences > Settings > Text Editor > Diff Editor > Word Wrap
2. Via shortcut Keys
On Windows
ctrl + , (control + comma)
On Mac - correct me if I am wrong
command + , (command + comma)

Just want to add that some plugins, like GitLens, may mess this setting up.
E.g., with GitLens, it can add git blame information inline, at the end of each line of code, showing you who is responsible for that line's current version, and when.
Unfortunately, this information will not only be to the right of the wrap column, e.g. 80, it'll also "unlock" the horizontal scrolling, even when no GitLens blame annotation is there.
I haven't found any fix for this other than disabling such features.

Just press ALT + Z -> To enable/disable the horizontal scroll

Config: MBP 2018 | Using Magic Mouse 2.
For me, I had accidentally set the 'Scroll Beyond Last Column' to 80 chars. Just resetting it to default settings is what worked for me. Hope it does for you all!
Update (6th Feb, 2021): Enabling the mini-map again causes the problem. So disabled it to get rid of the issue.

⌥ + z
the shortcut for Mac. you welcome

February 2020 (version 1.43) update adds an option called: Scroll Predominant Axis
Scrolling predominant axis
When trying to scroll vertically using a modern touchpad, it oftentimes happens that the file scrolls horizontally as well. There is now a new setting, editor.scrollPredominantAxis (which is set to true by default) which blocks "diagonal" scrolling. This forces scrolling gestures to be either vertical or horizontal (based on the highest absolute scroll delta), but never diagonal.
When enabled,it prevents any diagonal scrolling.
It guesses your scrolling to either vertical scroll or horizontal scroll.
It says by default it is enabled. If not then you can enable in Scroll Predominant Axis in settings.
Screenshot: Editor: Scroll Predominant Axis
Or in settings.json
"editor.scrollPredominantAxis": true

Use Ctrl + E, then Ctrl + W for disable horizontal scrolling.
For more details, you can refer this cite: https://developercommunity.visualstudio.com/t/disable-horizontal-scrolling-in-visual-studio-2019/612873.

Related

Fix scrollbox length on the vertical scrollbar [Visual Studio 2019]

Using Visual Studio 2019 Professional (and if relevant, editing C#). While using the IDE, the Scrollbox on the vertical scrollbar keeps changing size depending on where you are in the document. It might be smaller at the bottom and then get bigger as you scroll upwards or vice versa. This is disconcerting and makes navigation harder.
In the image below, Options > Environment > Fonts and Colors > Overview background is set to Maroon to better show the Scrollbox in case there is ambiguity. The Scrollbox is the bit between the orange lines which you can grab to scroll up and down.
In Notepad++, the Scrollbox size depends on the height of the application and the number of lines in the text file being edited. The size (correctly) changes size when you add or remove lines, but it does not change size dynamically depending on where you are in the document. This is the functionality I'm looking for.
A related Stackoverflow question suggested disabling Edit > Advanced > Word Wrap. This does not resolve the issue.
How do you turn off "dynamic Scrollbox sizing while scrolling"?
When the IDE is in Map mode, it does not appear to be possible to fix the Scrollbox height.
To resolve this issue, go to Options > Text Editor > All Languages > Scroll Bars > Behaviour, and select Use bar mode for vertical scroll bar.

Xcode 11 vertical position of editors

In Xcode 10 (and earlier) we could have two editors vertically stacked on top of each other. I have not managed to do that in Xcode 11, only horizontally stacked, which is not optimal using my rotated monitor (using my monitor "in portrait" mode).
Is it possible to vertically align editors?
Choosing File > New > Editor Below will add an editor below the current editor and tell Xcode to vertically stack future editors for that project. You can also choose View > Change Editor Orientation to toggle stacking editors vertically and horizontally.
Thanks to #Mark's answer I knew that it was possible to do vertical alignment of editors, but just now I also discovered that the good old shortcut gets updated according to current Editor aligment.
CMD + SHIFT + O ('Open quickly')
Enter name of type/file you would like to open in a new editor, select the file in the list
Followed by
ALT + ENTER to open the selected file in a new editor (using latest preferred alignemt)

How to make VSCode editor stop scrolling past bottom of a file?

In the VSCode editor when you pull the scroll bar down to the bottom of the file, all you see is a blank page, since the text has scrolled up past the top of the text editor window. This makes scrolling to the bottom difficult because you can't just pull the scroll bar quickly all the way down but have to carefully position the cursor so you can still see your code.
Very similar to How to make Visual Studio editor stop scrolling past bottom of a file?, but comments have pointed out that question/answer is for Visual Studio. This answer is for VSCode on the macOS and Windows.
The correct answer is seen here: https://stackoverflow.com/a/40588828/1189470
There is a configuration option provided in VSCode for the functionality you specified. To enable it, go to File -> Preferences -> user settings
On the right side of the editor in settings.json paste the below line at the bottom (before closing bracket), save and close.
"editor.scrollBeyondLastLine": false
This will prevent the editor from scrolling beyond the last line.
This is now exposed as a simple checkbox labeled "Editor: Scroll Beyond Last Line" in File/Apple -> Preferences.
If just for readability you would like some space at the bottom of the file - a configurable amount - try this setting as of v1.43:
editor.padding.bottom in pixels
Editor> Padding: Bottom
Controls the amount of space between the bottom edge of the editor and
the last line.
and/or
editor.padding.top // but this isn't sticky in the sense that you can scroll right past the padding top and it is gone. It doesn't stay.

How to scroll horizontally in emacs?

I can't get emacs to scroll horizontally!
To replicate the problem:
Open the *scratch* buffer.
Write a long line.
Make the long line exceed the window width with M-xtoggle-truncate-lines. The left hand text (column 0) will now be off the left of the window.
Try M-xscroll-left or its shortcut C-x < to scroll left.
Type y to enable the disabled commands.
NOTHING HAPPENS!
I also tried C-a to go to the beginning of the line.
I also tried M-xtoggle-horizontal-scroll-bar but got the error message "Horizontal scroll bars aren't implemented yet".
There seems to be no way to scroll horizontally!
I need this because I have many wide CSV files to read.
I'm using the latest prelude on emacs 24.5 on Windows 10.
I filed an issue on the prelude project in case it is a genuine bug and could be fixed there.
You seem not to understand how horizontal scrolling works. It's not intuitive, that's why the command is disabled by default.
When I press C-x< at the end of the long line, the line disappears to the left. When I press C-x> there, nothing happens.
Pressing C-x< at the beginning of the long line, though, shows the second part of the long line.
Consider using visual-line-mode or even the csv-mode instead.
There is new a feature in Emacs 26. You can customize mwheel-tilt-scroll-p and use mouse to scroll.
M-x customize group RET mouse
Then set mwheel-tilt-scroll-p to t
No need to handroll it yourself. This is provided out of the box in emacs 27, and it probably was available for longer:
This feature is off by default; the variable mouse-wheel-tilt-scroll turns it on, if you customize it to a non-nil value.
(setq mouse-wheel-tilt-scroll t)
Sounds like xemacs have horizontal scroll in a 'natural' way.
As far as I can see it there is a [Options] button in the menubar, when clicking on it there is a [Frame Appearance] sub menu and there, there are 2 button []scrollbars, [] Truncate Lines
When these 2 buttons are checked in, long line are truncated and scrolling is smooth.
May be xemacs is non standard though.
I use it, I find it easy to cut/paste even rectangular areas, selection is faster and more precise to me that what I could achieve with keyboard meta-ctrl-shift stroke alone.
Cheers
Phi
I

More screen space in MSVS?

I am using visual studios 2008. My laptop has the max screen res of 1366x768.
What can i do to get more reading space? i was thinking of making the font smaller but it would be more helpful if i can make everything smaller (toolbar icons, text, etc)
The only improvement i done so far was remove a bunch of things under the toolbar so i have only one line. Actually for this project i remove the standard bar so i have have the solution and text directly under the menu with no toolbar. What else can i do to maximize reading space.
Tools > Options > Environment > General > Uncheck "Show status bar"
Tools > Options > Text Editor > All Languages > Uncheck "Navigation bar"
Install the "Hide Main Menu" extension available here.
Enable Auto-hide the taskbar in your Windows Taskbar properties.
That should get you at least 5-7 more lines.
Dual screens. The more pixels the better. I like 1920x1280 extended to across a matched monitor with vertically split tabs.
Probably not the answer you are looking for, but really, it HELPS A LOT.
Ok ok:
Try Lucida Console as a font - it's readable at 8pt - and fixed width!
Hit Alt+Shift+Enter to get into Full Screen mode.
Float all your "helper" windows and use Ctrl+Tab to get to them. (Click using mouse)
Pin your Windows Task Bar to the left or right of your screen to give more vertical reading space.
What I do is unpin all the various tool windows and views. Unpin the Solution Explorer, Properties viewer, Output etc. and the Toolbar. This leaves you with just the coding window and small bars around that allow you to hover over the edges of the window and see everything you just unpinned.
set the Solution explorer on the right to Auto-Hide, close the error window when possible (as in when you're not fixing errors), and try and drop the number of toolbars vertically to 1. You can also change the size of the text down by going to Tools > Options > Environment > Fonts and colors but i wouldn't shrink the text unless you have good vision. I recommend Consolas 12 Point for your code; it's a bit big but very nice looking!
I got rid of the toolbars altogether and made things like the Solution Explorer autohide. I came to the realisation that the only toolbar button I ever used was a custom tool one I'd put there (I use the menu for that now). I'm running at 1920x1200 so real estate wasnt an issue - I just wanted less visual distractions. Just me and the code.

Resources