maxedison
maxedison

Reputation: 17553

Importing default sublime text commands into a custom command

I'm writing a command that needs to copy the current file's path. Sublime Text already has a copy_path command that achieves this. Is it possible to import that command into my command's file? I have tried import copy_path and import CopyPathCommand. I have also tried calling the command as if it were a method on the sublime module, i.e. sublime.copy_path() but all of these attempts have resulted in errors.

Upvotes: 0

Views: 68

Answers (1)

r-stein
r-stein

Reputation: 4847

To import the command you can write from Default.copy_path import CopyPathCommand. However it sounds as if you run the command for which you don't need to import it. Just write self.view.run_command("copy_path") inside your TextCommand and it will be executed.

Upvotes: 2

Related Questions