How to disable horizontal scroll in visual studio code?
ScrollVisual Studio-CodeScroll Problem Overview
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.
Scroll Solutions
Solution 1 - Scroll
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 https://stackoverflow.com/questions/38561881/how-do-i-turn-on-text-wrapping-by-default-in-vs-code
Solution 2 - Scroll
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.
Solution 3 - Scroll
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)
Solution 4 - Scroll
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.
Solution 5 - Scroll
Just press ALT + Z -> To enable/disable the horizontal scroll
Solution 6 - 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.
Solution 7 - Scroll
⌥ + z
the shortcut for Mac. you welcome
Solution 8 - Scroll
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
Solution 9 - Scroll
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.