Skip to content

Instantly share code, notes, and snippets.

@amiralles
Created September 8, 2023 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amiralles/e975f39410324fea9bc0ee4e44550b46 to your computer and use it in GitHub Desktop.
Save amiralles/e975f39410324fea9bc0ee4e44550b46 to your computer and use it in GitHub Desktop.
Change View Font Size plugin for ST4
import sublime
import sublime_plugin
class ChangeViewFontSizeCommand(sublime_plugin.TextCommand):
def run(self, edit, by):
settings = self.view.settings()
settings.set("font_size", settings.get("font_size") + by)
@amiralles
Copy link
Author

This command will help you if you are working on a multimonitor setup with different resolutions.
Sadly, ST doesn't support setting different font sizes for different windows, so this is a nice trick to overcome that limitation.

Once you install this plugin, add these settings to your keybindings file so that you can zoom in and out on a per-view basis:
(Changes on the current view won't affect any other view or ST windows.)

  {
      "keys": ["ctrl+shift+="],
      "command": "change_view_font_size",
      "args": {
          "by": 1,
      }
  },
  {
      "keys": ["ctrl+shift+-"],
      "command": "change_view_font_size",
      "args": {
          "by": -1,
      }
  },

Full credit to this fine gentleman: https://forum.sublimetext.com/t/different-font-sizes-for-different-windows/36359/3?u=amiralles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment