Skip to content

Instantly share code, notes, and snippets.

@mattst mattst/sort_view_items.py
Last active May 27, 2017

Embed
What would you like to do?
sort_view_items
def sort_view_items(self):
cs = self.settings.case_sensitive
if self.settings.sort_by_file_name:
sk = lambda vi: (vi.name if cs else vi.name.lower(), vi.group, vi.tab)
elif self.settings.sort_by_folder:
sk = lambda vi: (vi.folder, vi.name if cs else vi.name.lower())
elif self.settings.sort_by_syntax:
sk = lambda vi: (vi.syntax, vi.name if cs else vi.name.lower())
elif self.settings.sort_by_indexes:
sk = lambda vi: (vi.group, vi.tab)
self.view_items.sort(key = sk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.