Sublime Forum

Font size for Build Results window

#1

I found from googling that the font of the Build Result window in ST3 is inherited from the Plain Text syntax-specific settings. This is somewhat awkward. I would like to keep viewing plain text files wit normal font, and view build results with smaller font. Is there a possible workaround, to tweak font of the Build Results window independently of any specific file syntax?

A related point - is it possible to make spell checking (F6) not to be ever applied to Build Results window?

0 Likes

#2

There is indeed a way to change this; I guess technically I would call it a workaround since it doesn’t immediately apply to every build output and requires you to modify the sublime-build file for any build that you want to change.

One of the arguments that a sublime-build can take is syntax, which specifies what syntax to apply to the output view. The default value if that argument is not supplied is the Plain Text syntax. By supplying your own syntax to the build, you can apply your own syntax specific settings, which can be anything (including not only the font size but also spelling).

To do so, you would first create a file named Build Output.sublime-syntax in your User package with the following contents:

%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Build Output
scope: text.plain.build
hidden: true
contexts:
  main: []

This creates a new syntax for use in our build output; it’s essentially the plain text syntax but with a different scope applied so that we can distinguish it as build output. The hidden: true hides the syntax from the command palette and menus; you can remove that if so desired.

With that in place, you can then create a file named Build Output.sublime-settings (i.e. it has to be named the same as the syntax file) and in that file apply any syntax specific settings that you want. For example:

{

    "font_size": 7,
    "spelling_selector": "-text.plain.build"
}

This alters the font size and also turns off spelling by excluding the build output top level scope (from the syntax definition) while inside the build output.

With that in place, you’re ready to roll. For any sublime-build you can include a syntax key and point it to this syntax, which will make that build use this syntax in the panel, applying the appropriate settings.

A simple example of that based on the above is:

{
    "shell_cmd": "dir",
    "syntax": "Packages/User/Build Output.sublime-syntax"
}

1 Like

Changing font size of the results screen
#3

For completeness I should also mention that technically speaking, you can use PackageResourceViewer to create an override on Default/exec.py and modify the default syntax to the one above. If you do that, then it automatically applies to any build that doesn’t specify it’s own syntax.

That’s a bit more invasive in that you run the potential risk of masking changes made to the base exec command if/when it gets updated in future Sublime Text builds. You can mitigate that by using my OverrideAudit package to warn you when that happens.

0 Likes

#4

Many thanks, OdatNurd! Your solutions works for me.

0 Likes

#5

Well, this method seems to fail for those sublime-builds which do not have the default exec value for their target option. Because, according to the docs,

If a value other than exec is specified, none of the options in exec Target Options will do anything.

E.g., I use LaTeXTools, and in LaTeX.sublime-build it has "target": "make_pdf". I wonder now if it’s possible to override this sublime-build such that the Build Output syntax was in effect for it too…

0 Likes

#6

Ah yes, indeed so. For custom build targets a more invasive solution may be required. The same general thing works (i.e. the appropriate syntax needs to be set in the panel and then everything else Just Works :tm:), but it may or may not be simplistic to get the syntax in there.

If the custom build uses exec internally to actually perform the build, then the override method I mentioned above would fix the problem, but if it invokes programs on its own then that won’t work.

0 Likes