Sublime Forum

Typo Macro: DeleteLine.sublime-macro

#1

In the file:
Should that be
True rather than true?

~ Thanks, Rob

Details.

File:

/Users/xxx_iMac/Library/Application Support/Sublime Text 2/Packages/Default/Delete Line.sublime-macro


    {"command": "expand_selection", "args": {"to": "line"}},
    {"command": "add_to_kill_ring", "args": {"forward": true}},
    {"command": "left_delete"}
]

I get error in my plugin (snippet here), unless I change true to True

import sublime, sublime_plugin

class ppCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.run_command("expand_selection", {"to": "line"})
        self.view.run_command("add_to_kill_ring", {"forward": True})
        self.view.run_command("left_delete")

Thanks,
Rob

0 Likes

#2

JSON uses “true”, Python uses “True”. Nothing odd here.

0 Likes

#3

Thanks… that explains it.

I also learned I can call it from a plugin, the same way the hotkey calls it…
( “command”: “run_macro_file”, “args”: {“file”: “Packages/Default/Delete Line.sublime-macro”})

In a plugin:

import sublime, sublime_plugin

class ppCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        # self.view.run_command("expand_selection", {"to": "line"})
        # self.view.run_command("add_to_kill_ring", {"forward": True})
        # self.view.run_command("left_delete")
        self.view.run_command("run_macro_file", {"file": "Packages/Default/Delete Line.sublime-macro"})
0 Likes