Sublime - 根据构建系统更改背景颜色
Sublime - Change background color based on Build System
有一个问题询问如何根据文件类型更改背景颜色,Sublime 2 -changing background color based on file type?。
我想到了类似的事情。我正在考虑根据当前的 Sublime 构建系统更改背景颜色。有可能吗?
例如,红色表示 Python,绿色表示 LaTeX,蓝色表示自动。
有一些 built-in commands to run a specified build system or to set a particular one as the active build system, so you could possibly set an EventListener
监听 set_build_system
命令并触发插件以更改当前视图的背景(或 window 中的所有视图,或所有视图在所有 windows) 构建系统更改时。
这是一个简短的概念证明:
import sublime
import sublime_plugin
class ListenToBuildSystem(sublime_plugin.EventListener):
def on_window_command(self, window, command, args):
if command == "set_build_system":
window.run_command("toggle_minimap")
每次更改构建系统时都会切换小地图的显示。
有一个问题询问如何根据文件类型更改背景颜色,Sublime 2 -changing background color based on file type?。
我想到了类似的事情。我正在考虑根据当前的 Sublime 构建系统更改背景颜色。有可能吗?
例如,红色表示 Python,绿色表示 LaTeX,蓝色表示自动。
有一些 built-in commands to run a specified build system or to set a particular one as the active build system, so you could possibly set an EventListener
监听 set_build_system
命令并触发插件以更改当前视图的背景(或 window 中的所有视图,或所有视图在所有 windows) 构建系统更改时。
这是一个简短的概念证明:
import sublime
import sublime_plugin
class ListenToBuildSystem(sublime_plugin.EventListener):
def on_window_command(self, window, command, args):
if command == "set_build_system":
window.run_command("toggle_minimap")
每次更改构建系统时都会切换小地图的显示。