I'm trying to create a plug-in which intercepts the new file command and opens the new tab to the right of all existing tabs. My code looks something like:
import sublime, sublime_plugin
def on_new(self, view):
print ("new file")
w = view.window()
w.set_view_index(view, w.active_group(), len(w.views_in_group (w.active_group())) - 1)
The problem appears to be that the view doesn't have a window associated with it at the point at which the event fires, making it (as far as I can tell) impossible to move the new file's tab to the rightmost of the rest. Perhaps this event should fire after the view has a window or another event created, like on_after_new_complete.