Sublime Text 3:如何创建按键绑定来启用和禁用 Anaconda linting?

我希望能够使用热键来启用/禁用 anaconda linting。每次要用的时候都要打开设置,真的很不方便。我是 Sublime Text 的新手,但从我在按键绑定中看到的情况来看,您可以使用参数传递变量。例如:

[{"keys": ["ctrl+q"], "command": "toggle_comment", "args": {"block": false}}]

所以,我在想,也许有一个命令可以更改包“settings - user”并传递一个 var 将 ["anaconda_linting": false,] 设置为 true 或 false?


互换的青春
浏览 109回答 1
1回答

拉风的咖菲猫

您可以使用自定义插件和键绑定来完成此操作。选择Tools → Developer → New Plugin…并设置打开的文件的内容:import sublimeimport sublime_pluginclass ToggleAnacondaLintingCommand(sublime_plugin.ApplicationCommand):    def run(self):        s = sublime.load_settings("Anaconda.sublime-settings")        current = s.get("anaconda_linting")        new = not current        s.set("anaconda_linting", new)        sublime.save_settings("Anaconda.sublime-settings")        sublime.active_window().run_command('save')点击CtrlS保存,您的Packages/User文件夹应该打开。将文件另存为toggle_anaconda_linting.py.现在,打开您的按键绑定并在[ ]字符之间添加以下内容(选择您想要的任何快捷方式):{"keys": ["ctrl+alt+shift+l"], "command": "toggle_anaconda_linting"},现在,每当您点击快捷方式时,"anaconda_linting"所有文件都会切换。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python