Skip to content

Instantly share code, notes, and snippets.

@agibsonsw
agibsonsw / PyHelp.py
Created March 13, 2012 17:13
Python help (ST)
import sublime, sublime_plugin
help = {
'abs': 'Returns the absolute value of a number, or the magnitude of a complex number',
'all': 'Returns True if all elements of an iterable are true (or the iterable is empty)',
'any': 'Returns True if any of the elements of an iterable are true (False if the iterable is empty)',
'basestring': 'Superclass for str and unicode - used with isinstance function',
'bin': 'Converts an integer number to a binary string',
'bool': 'Converts a value to a Boolean, of False if no argument',
'bytearray': 'Returns a new array of bytes - a mutable sequence of integers 0-256',
@agibsonsw
agibsonsw / PythonCompletions.py
Created March 13, 2012 17:11
Python completions
import sublime, sublime_plugin
import re
def match1(rex, str):
m = rex.match(str)
if m:
return m.group(0)
else:
return None
@agibsonsw
agibsonsw / OrderedFiles.py
Created March 9, 2012 19:07
ST navigate sorted files (Window)
import sublime, 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
@agibsonsw
agibsonsw / SortTabs.py
Created March 9, 2012 18:42
Sort Tabs (Window Command)
import sublime, sublime_plugin
from os import path
from operator import itemgetter
class SortTabsCommand(sublime_plugin.WindowCommand):
def run(self):
file_views = []
win = self.window
curr_view = win.active_view()
for vw in win.views():
@agibsonsw
agibsonsw / OrderedFiles.py
Created March 8, 2012 18:56
ST navigate sorted files (neater 2)
import sublime, sublime_plugin, os
from operator import itemgetter
from datetime import datetime
class OrderedFilesCommand(sublime_plugin.TextCommand):
def run(self, edit, index):
OF = OrderedFilesCommand
OF.file_views = []
win = self.view.window()
for vw in win.views():
@agibsonsw
agibsonsw / SortTabs.py
Created March 7, 2012 20:26
ST sort tabs (neater)
import sublime, sublime_plugin, os
from operator import itemgetter
class SortTabsCommand(sublime_plugin.TextCommand):
def run(self, edit):
file_views = []
win = self.view.window()
curr_view = win.active_view()
for vw in win.views():
head, tail = os.path.split(vw.file_name())
@agibsonsw
agibsonsw / OrderedFiles.py
Created March 7, 2012 19:37
ST navigate sorted files (neater)
import sublime, sublime_plugin, os, datetime
from operator import itemgetter
file_views = []
class OrderedFilesCommand(sublime_plugin.TextCommand):
def run(self, edit, index):
global file_views
file_views = []
win = self.view.window()
@agibsonsw
agibsonsw / OrderedFiles.py
Created March 7, 2012 18:55
ST navigate sorted files (case insensitive)
import sublime, sublime_plugin, os, datetime
from operator import itemgetter
file_views = []
class OrderedFilesCommand(sublime_plugin.TextCommand):
def run(self, edit, index):
global file_views
file_views = []
for vw in self.view.window().views():
@agibsonsw
agibsonsw / SortTabs.py
Created March 7, 2012 18:46
ST sort tabs
import sublime, sublime_plugin, os
from operator import itemgetter
class SortTabsCommand(sublime_plugin.TextCommand):
def run(self, edit):
file_views = []
win = self.view.window()
curr_view = win.active_view()
for vw in win.views():
head, tail = os.path.split(vw.file_name())
@agibsonsw
agibsonsw / OrderedFiles.py
Created March 7, 2012 17:04
ST navigate sorted files
import sublime, sublime_plugin, os, datetime
from operator import itemgetter
file_views = []
class OrderedFilesCommand(sublime_plugin.TextCommand):
def run(self, edit, index):
global file_views
file_views = []
for vw in self.view.window().views():