Resetting font size shortcut for Sublime Text 3

Go to Preference->Settings and change the font size as you want....


For background, Sublime Text 3 has commands named increase_font_size and decrease_font_size. These commands modify the font size up or down by some value (depending on what it is currently set to) and then directly modify the setting in the Preferences.sublime-settings file, which makes the change permanent everywhere.

These commands are bound by default to Ctrl+WheelUp/Down as well as Ctrl++ and Ctrl+-.

There exists a command reset_font_size (not bound to a key by default), but this command works by erasing the font size setting entirely; thus if you weren't using the default font size, this is unlikely to be useful. Additionally, this would also not reset any e.g. syntax specific font size.

There is a set_setting command which could be used to set the font size to one that you desire in a key binding, but this only modifies the font size of the current view (while the commands above make the change permanent globally), so this is a non-solution.

A solution that doesn't require a plugin to modify the behaviour would be to remove the binding from the mouse wheel entirely, or alter it so that it requires a different modifier key. That way it won't trigger by accident at all.

In order to do that, you need to create or modify the file Packages\User\Default.sublime-mousemap. In order to determine where your User package is stored, you can use Preferences > Browse Packages from the menu.

Something like the following stored as the contents of that file will remove the binding completely, so that font changes with the mouse wheel are not possible. If the file already exists, just add the second and third lines to the file, making sure that all entries end in a comma.

[
    { "button": "scroll_down", "modifiers": ["ctrl"], "command": "noop" },
    { "button": "scroll_up", "modifiers": ["ctrl"], "command": "noop" }
]

If you still want this functionality from the mouse, then you need a couple of extra lines to add the commands back. It's important that the two lines that map to the noop command remain; if you don't override them explicitly the defaults will remain.

Here's an example of requiring Shift and Control to both be held during a mouse scroll to modify the font size.

[
    { "button": "scroll_down", "modifiers": ["ctrl"], "command": "noop" },
    { "button": "scroll_up", "modifiers": ["ctrl"], "command": "noop" },

    { "button": "scroll_down", "modifiers": ["shift", "ctrl"], "command": "decrease_font_size" },
    { "button": "scroll_up", "modifiers": ["shift", "ctrl"], "command": "increase_font_size" }
]

However, there isn't a keyboard shortcut for resetting the zoom/font size. Normally this would be super + 0(aka cmd + 0) in most apps, but Sublime Text doesn't give you this by default.

To get this feature you need to add the following to your keyboard bindings (found under Preferences -> Key Bindings)

  { "keys": ["super+0"], "command": "reset_font_size" }

Courtesy: coderwall.com


Go to Preferences>keybinding

{ "keys": ["ctrl+shift+0",], "command": "reset_font_size" },

add this line at the last line before "]" in the right panel and save it.
Now every time you want to reset use this keyboard shortcut.