Gaurav
Gaurav

Reputation: 357

How to reset VS Code's window zoom setting?

While changing VS Code's "windows zoom" setting, I accidentally changed the zoom setting to 10, so now it is zoomed so much that I can't change it to default.

enter image description here

Upvotes: 14

Views: 15049

Answers (6)

Gabriel Staples
Gabriel Staples

Reputation: 52499

VSCode window zoom for all windows and editors: zoom in and out, reset zoom, use fractional values

The Window zoom settings affect all GUI elements in VSCode, including the editor, the sidebar, the status bar, the command palette, the settings, etc. This setting shows up in the settings.json file as "window.zoomLevel": 0,, for example. It affects all open VSCode Windows. If you'd just like to zoom in and out in this window's editor only, see the section below on "Editor font size zoom" instead.

You can zoom in and out with Ctrl + + (technically Ctrl + =), and Ctrl + -, respectively.

But, that doesn't tell you where your default zoom level is exactly. To reset back to the default zoom level in a single go, there are three ways:

  1. If you have a numpad on your keyboard (I don't): Ctrl + NumPad0
  2. From the command menu: press Ctrl + Shift + P to enter the command menu, then search for "View: Reset Zoom", and select it.
  3. Open your user settings.json file by pressing Ctrl + Shift + P and then searching for "Preferences: Open User Settings (JSON)". Find your "window.zoomLevel" and set it to "window.zoomLevel": 0,.

Your zoom will be back to default.

If you're editing your user settings.json file directly (located at ~/.config/Code/User/settings.json on Linux, by the way), here are a few more possible values for it, to help you gain understanding:

// zoomed out 8 levels (this is the minimum zoom)
"window.zoomLevel": -8,


// zoomed out one level
"window.zoomLevel": -1,

// default zoom level
"window.zoomLevel": 0,

// zoomed in one level
"window.zoomLevel": 1,


// zoomed in 8 levels (this is the maximum zoom)
"window.zoomLevel": 8,

As you manually zoom in and out with Ctrl + + and Ctrl + -, you can see this setting change. When you get to the default zoom level of 0, it will remove the setting entirely, since that's the default zoom level.

You can open the default settings file to see all default settings by pressing Ctrl + Shift + P and then searching for "Preferences: Open Default Settings (JSON)".

In there you'll see this for the window zoom level. Notice that the explanation says you can also use zoom decimals for finer granularity (ex: "window.zoomLevel": 0.5):

// Adjust the zoom level of the window. The original size is 0 and each
// increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or
// smaller. You can also enter decimals to adjust the zoom level with a finer
// granularity.
"window.zoomLevel": 0,

Editor font size zoom (separate for each open Window in VSCode)

If you have multiple windows of VSCode open, you can adjust the font size zoom only for this one window by using the Editor Font Zoom commands instead. Press Ctrl + Shift + P to enter the command menu, then search for Editor Font Zoom, and select one of the three options below:

  1. Editor Font Zoom In
  2. Editor Font Zoom Out
  3. Editor Font Zoom Reset

...as shown here:

enter image description here

These do not create a new setting entry inside settings.json. Instead, they just change the font size of the editor in the current window, allowing you to have different font sizes in different windows.

This is very useful when you have multiple monitors with different resolutions, and you want to have a different font size on each monitor. You may need to set the Window zoom which affects all windows to meet your needs on the main monitor, but then adjust the font zoom only on the secondary monitor to make it look right. I have a 4k 32" main monitor with a huge resolution of 3840 x 2160, making everything on it tiny, and a really old monitor with a tiny resolution of 1280 x 1024, making everything on it look huge. Now, I can use Editor Font Zoom Out repeatedly on the old monitor to make it zoom out enough that it's usable and still provides a really good size editor window.

You can also set keyboard shortcuts for these commands in your keybindings.json file. We will add these shortcuts:

  1. Ctrl + Shift + = = Editor Font Zoom In
  2. Ctrl + Shift + - = Editor Font Zoom Out
  3. Ctrl + Shift + 0 = Editor Font Zoom Reset

Press Ctrl + Shift + P to enter the command menu, then search for Preferences: Open Keyboard Shortcuts (JSON) to open your keybindings.json file. Then, add these entries:

[
    // ... other keybindings here, then add:

    {
        "key": "ctrl+shift+=",
        "command": "editor.action.fontZoomIn"
    },
    {
        "key": "ctrl+shift+-",
        "command": "editor.action.fontZoomOut"
    },
    {
        "key": "ctrl+shift+0",
        "command": "editor.action.fontZoomReset"
    }
]

Save the file and close it, and now you can use the 3 new shortcuts above.


That's everything I know about VSCode zoom.

See also

  1. How to change font size in VS Code sidebar?
  2. Get all of my VSCode settings in my eRCaGuy_dotfiles repo here:
    1. ~/.config/Code/User/settings.json
    2. ~/.config/Code/User/keybindings.json

Upvotes: 18

amm98d
amm98d

Reputation: 2145

There are two types of zooms in VS Code:

  • Window zoom level: to reset, use Ctrl+Numpad0
  • Editor font zoom level: to reset, press Ctrl+Shift+P, search "Editor Font Zoom Reset". That's your guy.

Upvotes: 9

user15336376
user15336376

Reputation:

Go to this path C:\Users\<your admin name>\AppData\Roaming\Code\User

then open the settings file with any text editor at the end of the file change the window.zoomLevel to 0

after changing :

"window.zoomLevel": 0

Upvotes: 0

Aramis Baron
Aramis Baron

Reputation: 61

click the reset zoom setting under View>Appearance>Reset Zoom.Otherwise you can use the hotkey which is (CTRL + -).

Upvotes: 6

Talal Siddiqui
Talal Siddiqui

Reputation: 106

Use (Ctrl+-) to zoom out. Its simple you can google it as well

https://code.visualstudio.com/docs/editor/accessibility

Upvotes: -1

polypode
polypode

Reputation: 501

You can do Ctrl + - to dezoom.

Upvotes: 0

Related Questions