Is it possible to disable syntax highlighting in S

2020-03-12 04:32发布

问题:

Is there any way to disable the syntax highlighting in SublimeREPL-tabs when a script is running?

Please see this question for context: Red lines coming up after strings in SublimeREPL (python)?

For example, when python-scripts run in Sublime REPL, apostrophes (') in the output-text get highlighted as syntax. Because of this, the last part of the line is highlighted as if the string (which in fact is text-output and not actual code) was not closed properly.

This is what the output looks like:

The highlighting is useful when Sublime REPL is running the interactive python shell, but when it just should run a script, I would like to get the text output without highlighting, like in any commandline-interface. Of course I could just run the scripts in the commandline, but it would be nice to keep all work focused in just one program.

Maybe there are settings for the different kinds of Sublime REPL-enveronments (Interactive, run from script, etc.) that could change this behaviour?

Thanks for any help! :)

回答1:

Go to Sublime Text > Preferences > Package Settings > SublimeREPL > Settings - User

(If your 'Settings - User' is empty, first copy in the contents of 'Settings - Default')

under "repl_view_settings": add:

,
    "syntax": "Packages/Text/Plain text.tmLanguage"

so mine is now:

// standard sublime view settings that will be overwritten on each repl view
// this has to be customized as a whole dictionary
"repl_view_settings": {
    "translate_tabs_to_spaces": false,
    "auto_indent": false,
    "smart_indent": false,
    "spell_check": false,
    "indent_subsequent_lines": false,
    "detect_indentation": false,
    "auto_complete": true,
    "line_numbers": false,
    "gutter": false,
    "syntax": "Packages/Text/Plain text.tmLanguage"
},


回答2:

As @joe.dawley wrote in the comments to the original question there is a way to manually disable syntax highlighting in SublimeREPL by using the go to anything-command (Ctrl + Shift + P) and enter "sspl" to set the syntax to plain text.