def close_view(view):
"""
Closes the given view by running the close_by_index command.
If there are more than one open windows and the window has no more views it gets closed, too.
"""
window = view.window()
group_index, view_index = window.get_view_index(view)
window.run_command('close_by_index', {'group': group_index, 'index': view_index})
if len(sublime.windows()) > 1 and len(window.views()) is 0:
window.run_command('close')
评论列表
文章目录