Sublime Forum

Counting # of tabs open in Sublime Text

#1

Hello! I’m a long-time (ish, just a few years) user of Sublime Text. Currently, I’m using Sublime Text 4143.
For sentimental reasons, I have way too many tabs open, and I don’t really want to close them until I find out how many I have open :stuck_out_tongue: so… is there a way to count how many tabs? (Mac Monterey, in case that affects anything.)
Over a few years, I’ve accumulated enough tabs and windows that there are simply too many to count manually. I have several windows that I have to scroll for a few minutes to reach either end.
It’s also a big problem because with so many tabs, after I leave the application open for a few minutes, Sublime Text starts taking up about a dozen gigabytes of system memory, which is… too much for my 8GB memory desktop.
Thanks! It would be a GREAT help if anyone could help… :slight_smile:

0 Likes

#2

You can open the Sublime console with View > Show Console and enter:

[len(w.views()) for w in sublime.windows()]

That will give you a list of numbers, which represent the number of files that are open in each windoow. You can use len(window.views()) in the console of a specific window to see how many views are in a specific window as well.

1 Like

#3

Thanks, this was really helpful! By the way, is there anywhere I can learn more about this console in Sublime Text? I tried searching for Sublime Text console but I didn’t find any results. i.e. how do I manipulate data from the windows in Sublime Text?

0 Likes

#4

There won’t be any documentation on it in particular, for the most part; the console is an interface with the underlying plugin API (documented at: https://www.sublimetext.com/docs/api_reference.html)

1 Like