Skip to content

Instantly share code, notes, and snippets.

@hughshen
Created February 5, 2017 12:09
Show Gist options
  • Save hughshen/87fc3e218e04a45b1c6f19ae16e1ca94 to your computer and use it in GitHub Desktop.
Save hughshen/87fc3e218e04a45b1c6f19ae16e1ca94 to your computer and use it in GitHub Desktop.
Simple plugin for Sublime Text to display the opened files count in the status bar.
import sublime
import sublime_plugin
class OpenedFilesCountPlugin(sublime_plugin.EventListener):
def __init__(self):
return
def on_activated(self, view):
self.update_status(view)
def on_new(self, view):
self.update_status(view)
def on_close(self, view):
self.update_status(view)
def update_status(self, view):
files_count = len(sublime.active_window().views())
view.set_status('OpenedFilesCountPluginStatus', 'Editing %d file%s' % (files_count, ('s' if files_count > 1 else '')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment