Initial migratory commit from voussoir/else.
This commit is contained in:
commit
d035399681
21 changed files with 416 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
voussoir/*.pyc
|
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
voussoir's Sublime Text 2 config
|
||||
================================
|
||||
|
||||
If you download this you can feel what it's like to be me.
|
40
voussoir/Default (Windows).sublime-keymap
Normal file
40
voussoir/Default (Windows).sublime-keymap
Normal file
|
@ -0,0 +1,40 @@
|
|||
[
|
||||
{ "keys": ["ctrl+shift+w"], "command": "toggle_setting", "args": {"setting": "word_wrap"}},
|
||||
{ "keys": ["ctrl+shift+m"], "command": "toggle_minimap"},
|
||||
{ "keys": ["alt+shift+."], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" }},
|
||||
{ "keys": ["shift+delete"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"}},
|
||||
{ "keys": ["ctrl+shift+enter"], "command": "insert", "args": {"characters": "\n#"}},
|
||||
{ "keys": ["f4"], "command": "timestamp" },
|
||||
|
||||
// Auto-pair backticks
|
||||
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context":
|
||||
[
|
||||
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
|
||||
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$|;)", "match_all": true },
|
||||
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[`a-zA-Z0-9_]$", "match_all": true },
|
||||
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}`"}, "context":
|
||||
[
|
||||
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["`"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
|
||||
[
|
||||
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
|
||||
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context":
|
||||
[
|
||||
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
|
||||
{ "key": "preceding_text", "operator": "regex_contains", "operand": "`$", "match_all": true },
|
||||
{ "key": "following_text", "operator": "regex_contains", "operand": "^`", "match_all": true }
|
||||
]
|
||||
}
|
||||
]
|
7
voussoir/Distraction Free.sublime-settings
Normal file
7
voussoir/Distraction Free.sublime-settings
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"line_numbers": true,
|
||||
"gutter": true,
|
||||
"wrap_width": 120,
|
||||
"word_wrap": false,
|
||||
"scroll_past_end": true
|
||||
}
|
11
voussoir/Preferences.sublime-settings
Normal file
11
voussoir/Preferences.sublime-settings
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
|
||||
"font_face": "Consolas",
|
||||
"font_size": 9,
|
||||
"rulers":
|
||||
[
|
||||
80,
|
||||
100
|
||||
],
|
||||
"scroll_speed": 0
|
||||
}
|
30
voussoir/argparse.sublime-snippet
Normal file
30
voussoir/argparse.sublime-snippet
Normal file
|
@ -0,0 +1,30 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
def $1_argparse(args):
|
||||
return $1()
|
||||
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
|
||||
parser.add_argument('required_positional')
|
||||
parser.add_argument('optional_positional', nargs='?', default=None)
|
||||
parser.add_argument('-k', '--kwarg', dest='kwarg', default=None)
|
||||
parser.add_argument('-b', '--boolkwarg', dest='boolkwarg', action='store_true')
|
||||
parser.set_defaults(func=$1_argparse)
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
return args.func(args)
|
||||
|
||||
if __name__ == '__main__':
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
|
||||
]]></content>
|
||||
<tabTrigger>argparse</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
32
voussoir/argparse_multi.sublime-snippet
Normal file
32
voussoir/argparse_multi.sublime-snippet
Normal file
|
@ -0,0 +1,32 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
def $1_argparse(args):
|
||||
return $1()
|
||||
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
subparsers = parser.add_subparsers()
|
||||
|
||||
p_$1 = subparsers.add_parser('$1')
|
||||
p_$1.add_argument('required_positional')
|
||||
p_$1.add_argument('optional_positional', nargs='?', default=None)
|
||||
p_$1.add_argument('-k', '--kwarg', dest='kwarg', default=None)
|
||||
p_$1.add_argument('-b', '--boolkwarg', dest='boolkwarg', action='store_true')
|
||||
p_$1.set_defaults(func=$1_argparse)
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
return args.func(args)
|
||||
|
||||
if __name__ == '__main__':
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
|
||||
]]></content>
|
||||
<tabTrigger>argparse_multi</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
15
voussoir/defmain.sublime-snippet
Normal file
15
voussoir/defmain.sublime-snippet
Normal file
|
@ -0,0 +1,15 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
def main(argv):
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
|
||||
]]></content>
|
||||
<tabTrigger>defmain</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
11
voussoir/hash_header.sublime-snippet
Normal file
11
voussoir/hash_header.sublime-snippet
Normal file
|
@ -0,0 +1,11 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
# $1
|
||||
################################################################################
|
||||
]]></content>
|
||||
<tabTrigger>hhh</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
42
voussoir/helptext.sublime-snippet
Normal file
42
voussoir/helptext.sublime-snippet
Normal file
|
@ -0,0 +1,42 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
from voussoirkit import betterhelp
|
||||
|
||||
DOCSTRING = '''
|
||||
____my__program____
|
||||
|
||||
{____my__command____}
|
||||
|
||||
TO SEE DETAILS ON EACH COMMAND, RUN
|
||||
> ____my__program____.py <command> --help
|
||||
'''.lstrip()
|
||||
|
||||
SUB_DOCSTRINGS = dict(
|
||||
____my__command____='''
|
||||
____my__command____:
|
||||
____my__command____description
|
||||
|
||||
> ____my__program____.py ____my__command____
|
||||
|
||||
flags:
|
||||
--____my__flag____:
|
||||
'''.strip(),
|
||||
)
|
||||
|
||||
DOCSTRING = betterhelp.add_previews(DOCSTRING, SUB_DOCSTRINGS)
|
||||
|
||||
def main(argv):
|
||||
return betterhelp.subparser_main(
|
||||
argv,
|
||||
parser,
|
||||
main_docstring=DOCSTRING,
|
||||
sub_docstrings=SUB_DOCSTRINGS,
|
||||
)
|
||||
|
||||
]]></content>
|
||||
<tabTrigger>helptext</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
12
voussoir/ifmain.sublime-snippet
Normal file
12
voussoir/ifmain.sublime-snippet
Normal file
|
@ -0,0 +1,12 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
if __name__ == '__main__':
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
|
||||
]]></content>
|
||||
<tabTrigger>ifmain</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
14
voussoir/listget.sublime-snippet
Normal file
14
voussoir/listget.sublime-snippet
Normal file
|
@ -0,0 +1,14 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
def listget(l, index, default=None):
|
||||
try:
|
||||
return l[index]
|
||||
except IndexError:
|
||||
return default
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
<tabTrigger>listget</tabTrigger>
|
||||
</snippet>
|
11
voussoir/ni=raise_notimplemented.sublime-snippet
Normal file
11
voussoir/ni=raise_notimplemented.sublime-snippet
Normal file
|
@ -0,0 +1,11 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
raise NotImplementedError
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
<tabTrigger>ni</tabTrigger>
|
||||
<description>raise NotImplementedError</description>
|
||||
</snippet>
|
18
voussoir/pipeablemain.sublime-snippet
Normal file
18
voussoir/pipeablemain.sublime-snippet
Normal file
|
@ -0,0 +1,18 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
from voussoirkit import pipeable
|
||||
|
||||
def main(argv):
|
||||
for line in pipeable.go(argv, strip=True, skip_blank=True):
|
||||
pipeable.output(line)
|
||||
|
||||
if __name__ == '__main__':
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
|
||||
]]></content>
|
||||
<tabTrigger>pipeablemain</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
10
voussoir/systemoutprintln.sublime-snippet
Normal file
10
voussoir/systemoutprintln.sublime-snippet
Normal file
|
@ -0,0 +1,10 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
System.out.println($1);$0
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
<tabTrigger>sysout</tabTrigger>
|
||||
</snippet>
|
11
voussoir/timestamp.py
Normal file
11
voussoir/timestamp.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
'''
|
||||
Thank you tpitale
|
||||
https://gist.github.com/tpitale/11e5a2a152ec67a172f9
|
||||
'''
|
||||
import datetime
|
||||
import sublime, sublime_plugin
|
||||
|
||||
class TimestampCommand(sublime_plugin.TextCommand):
|
||||
def run(self, edit):
|
||||
timestamp = "%s" % (datetime.datetime.now().strftime("%Y %m %d"))
|
||||
self.view.insert(edit, self.view.sel()[0].begin(), timestamp)
|
27
voussoir/tkinter_geometry.sublime-snippet
Normal file
27
voussoir/tkinter_geometry.sublime-snippet
Normal file
|
@ -0,0 +1,27 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
self.windowtitle = 'Window'
|
||||
|
||||
self.t = tkinter.Tk()
|
||||
self.t.title(self.windowtitle)
|
||||
self.w = 800
|
||||
self.h = 525
|
||||
self.screenwidth = self.t.winfo_screenwidth()
|
||||
self.screenheight = self.t.winfo_screenheight()
|
||||
self.windowwidth = self.w
|
||||
self.windowheight = self.h
|
||||
self.windowx = (self.screenwidth-self.windowwidth) / 2
|
||||
self.windowy = ((self.screenheight-self.windowheight) / 2) - 27
|
||||
self.geometrystring = '%dx%d+%d+%d' % (self.windowwidth, self.windowheight, self.windowx, self.windowy)
|
||||
self.t.geometry(self.geometrystring)
|
||||
|
||||
self.build_gui_manager()
|
||||
|
||||
self.t.mainloop()
|
||||
]]></content>
|
||||
<tabTrigger>tkgeometry</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
43
voussoir/tkinter_scrollframe.sublime-snippet
Normal file
43
voussoir/tkinter_scrollframe.sublime-snippet
Normal file
|
@ -0,0 +1,43 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
import tkinter
|
||||
|
||||
class ScrollingFrame:
|
||||
def __init__(self, t):
|
||||
self.t = t
|
||||
self.frame_primary = tkinter.Frame(t)
|
||||
#self.frame_primary.pack(expand=True, fill='both')
|
||||
self.canvas = tkinter.Canvas(self.frame_primary)
|
||||
self.frame_inner = tkinter.Frame(self.canvas)
|
||||
|
||||
self.scrollbar = tkinter.Scrollbar(self.frame_primary, orient='vertical', command=self.canvas.yview)
|
||||
self.canvas.configure(yscrollcommand=self.scrollbar.set)
|
||||
|
||||
self.scrollbar.pack(side='right', fill='y')
|
||||
self.canvas.pack(expand=True, fill='both')
|
||||
self.canvas.create_window((0, 0), window=self.frame_inner, anchor='nw')
|
||||
|
||||
def frame_inner_fix(*event):
|
||||
children = self.frame_inner.winfo_children()
|
||||
if len(children) == 0:
|
||||
w = 25
|
||||
else:
|
||||
w = max(item.winfo_width() for item in children)
|
||||
h = self.t.winfo_height()
|
||||
self.canvas.configure(scrollregion=self.canvas.bbox("all"), width=w, height=h)
|
||||
|
||||
self.frame_inner.fix = frame_inner_fix
|
||||
self.frame_primary.bind('<Configure>', self.frame_inner.fix)
|
||||
|
||||
def pack(self, *args, **kwargs):
|
||||
self.frame_primary.pack(*args, **kwargs)
|
||||
|
||||
def grid(self, *args, **kwargs):
|
||||
self.frame_primary.grid(*args, **kwargs)
|
||||
]]></content>
|
||||
<tabTrigger>tkscrollframe</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
35
voussoir/tkinter_template.sublime-snippet
Normal file
35
voussoir/tkinter_template.sublime-snippet
Normal file
|
@ -0,0 +1,35 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
import tkinter
|
||||
|
||||
class Application:
|
||||
def __init__(self):
|
||||
self.windowtitle = 'Window'
|
||||
|
||||
self.t = tkinter.Tk()
|
||||
self.t.title(self.windowtitle)
|
||||
w = 800
|
||||
h = 525
|
||||
screenwidth = self.t.winfo_screenwidth()
|
||||
screenheight = self.t.winfo_screenheight()
|
||||
windowwidth = w
|
||||
windowheight = h
|
||||
windowx = (screenwidth-windowwidth) / 2
|
||||
windowy = ((screenheight-windowheight) / 2) - 27
|
||||
self.geometrystring = '%dx%d+%d+%d' % (windowwidth, windowheight, windowx, windowy)
|
||||
self.t.geometry(self.geometrystring)
|
||||
|
||||
self.build_gui_manager()
|
||||
|
||||
def build_gui_manager(self):
|
||||
pass
|
||||
|
||||
def mainloop(self):
|
||||
self.t.mainloop()
|
||||
]]></content>
|
||||
<tabTrigger>tktemplate</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
10
voussoir/utf-8.sublime-snippet
Normal file
10
voussoir/utf-8.sublime-snippet
Normal file
|
@ -0,0 +1,10 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
utf-8
|
||||
]]></content>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
<tabTrigger>uu</tabTrigger>
|
||||
</snippet>
|
32
voussoir/webpage.sublime-snippet
Normal file
32
voussoir/webpage.sublime-snippet
Normal file
|
@ -0,0 +1,32 @@
|
|||
<snippet>
|
||||
<content><![CDATA[
|
||||
<!DOCTYPE html5>
|
||||
<html>
|
||||
<head>
|
||||
{% import "header.html" as header %}
|
||||
<title>Title</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<link rel="stylesheet" href="/static/common.css">
|
||||
<script src="/static/common.js"></script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
</body>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
</html>
|
||||
|
||||
]]></content>
|
||||
<tabTrigger>webpage</tabTrigger>
|
||||
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
|
||||
<!-- <tabTrigger>hello</tabTrigger> -->
|
||||
<!-- Optional: Set a scope to limit where the snippet will trigger -->
|
||||
<!-- <scope>source.python</scope> -->
|
||||
</snippet>
|
Loading…
Reference in a new issue