Home Download Buy Blog Forum Support

ListTabs

ListTabs

Postby mads_hartmann on Sat Apr 28, 2012 7:26 pm

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: https://github.com/mads379/SublimeListTabs

/Mads
mads_hartmann
 
Posts: 9
Joined: Wed Feb 15, 2012 2:46 pm

Re: ListTabs

Postby C0D312 on Sat Apr 28, 2012 7:40 pm

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.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: ListTabs

Postby mads_hartmann on Sat Apr 28, 2012 7:45 pm

Almost :)

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 ;)

/Mads
mads_hartmann
 
Posts: 9
Joined: Wed Feb 15, 2012 2:46 pm

Re: ListTabs

Postby agibsonsw on Sun May 06, 2012 2:01 am

@mads_hartmann I don't know if my code below may be of interest to you ;) . 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: Select all
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])
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: ListTabs

Postby pappy on Fri May 25, 2012 11:42 pm

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!
pappy
 
Posts: 1
Joined: Fri May 25, 2012 11:40 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 8 guests