【问题标题】:Why the macro doesn't work?为什么宏不起作用?
【发布时间】:2018-08-05 14:28:34
【问题描述】:

这是宏,由于某种原因,它不起作用:

[
    { "command": "split_selection_into_lines" },
    { "command": "move_to", args: {"to": "hardeol"} },
    { "command": "move_to", args: {"to": "hardbol", "extend": true} },
]

我可以通过插件做同样的事情,但我不喜欢在这里使用它:

import sublime_plugin
class SplitIntoLinesReverseCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.run_command("split_selection_into_lines")
        self.view.run_command("move_to", {"to": "hardeol"})
        self.view.run_command("move_to", {"to": "hardbol", "extend": True})

为什么宏不起作用?

【问题讨论】:

    标签: macros sublimetext3 sublimetext2 sublimetext sublime-text-plugin


    【解决方案1】:

    宏不起作用,因为您用来定义它的 JSON 无效; args 键需要用双引号括起来,但事实并非如此。结果宏将无法加载,因此无法执行。

    如果您的配色方案支持,无效字符将突出显示以向您指示问题。

    修正后的版本是:

    [
        { "command": "split_selection_into_lines" },
        { "command": "move_to", "args": {"to": "hardeol"} },
        { "command": "move_to", "args": {"to": "hardbol", "extend": true} },
    ]
    

    【讨论】:

      猜你喜欢
      • 2018-09-03
      • 1970-01-01
      • 1970-01-01
      • 2014-07-28
      • 2013-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-04
      相关资源
      最近更新 更多