Sublime Forum

References to all views and windows

#1

Hi, guys. I’d like to write some window management commands and I could do with some help. I’d like to automatically close buffers with certain characteristics.

To do this, I need a view list, or a window list, or something like that. I can’t figure out how to get it. Actually, the one way I can think is to create a plugin, then manage a seperate list using OnNew, OnLoad, etc. But that seems like a workaround.

So, is there any way I can write something like;

for view in allViews():
if matchesCloseCriterion(view):
view.Close()

Any help appreciated.

1 Like

#2

sweet! cheers.

0 Likes

#3

FYI, the latest beta now exposes Window.views() to get a list of all views.

1 Like