Sublime Forum

How can I create a command to open a file in a new window?

#1

Is there a way to make a WindowCommand that opens a new file in a new window? If so, how? I thought the command called with Ctrl + Shift + N would be defined in a .py file inside the Default package, but I can’t find such definition.

0 Likes

#2

Not sure what’s the best way to do it, but you can just call the new new_window command (ctrl+shift+n) and then get the current window and operate on it:

sublime.run_command("new_window"); w = sublime.active_window(); w.open_file("my_file.txt")
1 Like

#3

Thank you very much! That looks indeed like just what I need

0 Likes