Sublime Forum

List open files with paths

#1

Is there a plugin or command that can gather all the names of open files in a ST window, with path, and summarise by listing them in one tab?

Thera was a plugin at one time I tried, I think it was ListOpenFiles. But that fell short by only gathering file names without path. In any case it is moot for it is not available for install using Package Control.

0 Likes

#3

That plugin does attempt to list all open files with a full path, but has a bug that causes it to not work in recent versions of Sublime Text. You can use this plugin instead (Tools > Developer > New Plugin…):

import sublime,sublime_plugin,os

class ListOpenFilesCommand(sublime_plugin.WindowCommand):
    def run(self):
        window = sublime.active_window()
        views = window.views()

        fileNames = ''
        for view in views:
            if view and view.file_name():
                fileNames += os.path.abspath(view.file_name())+'\n'

        window.new_file().run_command("insert", {'characters': "List of open files:\n\n"+fileNames})

You can then set a keybinding for the list_open_files command (Preferences > Key Bindings) like described by that package.

0 Likes

#4

@bschaaf
Thank you! :smiley: That plugin works perfectly.

0 Likes