Sublime Forum

ListTabs

#1

Hi,

I’ve created a plugin named SublimeListTabs; It Shows a quick panel with all of the open tabs.

Motivation: Sometimes I want to remove the clutter and only see the edit area so I hide the sidebar and the tabs. But now it’s hard to get an overview of your opened files and navigate them efficiently. To fix this I’ve created this plug-in that shows your open tabs in a quick panel.

Here’s the github repository: github.com/mads379/SublimeListTabs

/Mads

0 Likes

#2

Not to be rude, but unless I’m missing something, this is what the Goto Anything panel does. (control/command + P).

Anyway, its nice to see people looking to give back the the ST community.

0 Likes

#3

Almost :smile:

However, if you start typing in to Goto Anything view it will start searching for anything. With this plugin
it will just filter the tabs so it’s more efficient for navigating through your open files.

Also, this doesn’t activate the ‘quick preview’ feature. Some people love it, I personally don’t so that’s nice.
This might change in the future though if the semantics of ‘show_quick_panel’ is changed

So it isn’t that different from ‘Goto Anything’ but it’s different enough that I wanted to write a plugin for it :wink:

/Mads

0 Likes

#4

@mads_hartmann I don’t know if my code below may be of interest to you :wink: . I use two shortcuts to run this, one to list the files alphabetically and one to list by their last modified date.

It’s ignoring new/untitled files (and different groups) for the moment. I might modify it to work with new/blank views - I’ll use ‘datetime.now()’ as their ‘modified’ value, but I just need to convert this to a float value (to prevent it error-ing out when comparing it to the other modified (float) values).

[code]import sublime_plugin
from os import path
from operator import itemgetter
from datetime import datetime

class OrderedFilesCommand(sublime_plugin.WindowCommand):
def run(self, index):
OF = OrderedFilesCommand
OF.file_views = ]
win = self.window
for vw in win.views():
if vw.file_name() is not None:
_, tail = path.split(vw.file_name())
modified = path.getmtime(vw.file_name())
OF.file_views.append((tail, vw, modified))
else:
pass # leave new/untitled files (for the moment)
if index == 0: # sort by file name (case-insensitive)
OF.file_views.sort(key = lambda (tail, _, Doh): tail.lower())
win.show_quick_panel([x for (x, y, z) in OF.file_views], self.on_chosen)
else: # sort by modified date (index == 2)
OF.file_views.sort(key = itemgetter(2))
win.show_quick_panel(
(datetime.fromtimestamp(z)).strftime("%d-%m-%y %H:%M ") + x
for (x, y, z) in OF.file_views], self.on_chosen)
def on_chosen(self, index):
if index != -1:
self.window.focus_view(OrderedFilesCommand.file_views[index][1])[/code]

0 Likes

#5

This is (almost) exactly what I’ve been looking for. The only addition I’d like is to list tabs available in all sub-windows.

Thanks!

0 Likes