From 293093cab79b3c72b6b302328d59a365a6e3890e Mon Sep 17 00:00:00 2001 From: Ian Markind Date: Tue, 25 Sep 2018 01:14:54 -0400 Subject: [PATCH] added commands for php and python --- php-storm.py | 59 ++++++++++++++++++++++++++++++++-------------------- pycharm.py | 6 ++++-- 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/php-storm.py b/php-storm.py index 4acbd5d..2711d8d 100644 --- a/php-storm.py +++ b/php-storm.py @@ -8,11 +8,23 @@ i in app.bundle for i in ides)) +def foundation_breakpoint(): + def foundation_breakpoint_function(m): + Str('@include breakpoint() {')(None) + press('enter') + press('cmd-right') + press('up') + for x in range(3): + press('left') + + return foundation_breakpoint_function + + def blade_switch(): def blade_switch_function(m): Str('@switch($)')(None) press('return') - for x in range(0, 3): + for x in range(3): Str('@case()')(None) press('return') press('return') @@ -24,7 +36,7 @@ def blade_switch_function(m): press('return') Str('@endswitch')(None) press('shift-tab') - for x in range(0, 15): + for x in range(15): press('up') press('left') @@ -91,7 +103,7 @@ def blade_if_else_function(m): press('return') Str('@endif')(None) press('shift-tab') - for x in range(0, 4): + for x in range(4): press('up') press('left') @@ -101,7 +113,7 @@ def blade_if_else_function(m): def blade_php(): def blade_php_function(m): Str('@php @endphp')(None) - for x in range(0, 8): + for x in range(8): press('left') return blade_php_function @@ -110,13 +122,31 @@ def blade_php_function(m): def blade_include(): def blade_include_function(m): Str('@include(\'\')')(None) - for x in range(0, 2): + for x in range(2): press('left') return blade_include_function keymap = { + # PHP + 'echo': ['echo ;', Key('left')], + 'if': ['if', Key('tab')], + 'if markup': ['ifm', Key('tab')], + 'else if': ['elif', Key('tab')], + 'else if markup': ['elifm', Key('tab')], + 'else': ['else', Key('tab')], + 'else markup': ['elsem', Key('tab')], + '(flip | phiz | fizz)': ['php', Key('tab')], + 'party': ['phps', Key('tab')], + '(start flip | start phiz | start fizz)': ' ', + # 'search': [Key('shift'), Key('shift')], + 'golf': ['fore', Key('tab')], + 'horse': ['for', Key('tab')], + 'horse markup': ['formk', Key('tab')], + 'chop': ['forek', Key('tab')], + 'eagles': ['?=', Key('tab')], # blade 'blade if': blade_if(), @@ -145,24 +175,7 @@ def blade_include_function(m): # Foundation CSS Framework 'ramcalc': ['rem-calc()', Key('left')], - 'breakpoint': '@include breakpoint() {', - - '(flip | phiz | fizz)': ['php', Key('tab')], - 'party': ['phps', Key('tab')], - '(start flip | start phiz | start fizz)': ' ', - # 'search': [Key('shift'), Key('shift')], - 'golf': ['fore', Key('tab')], - 'horse': ['for', Key('tab')], - 'horse markup': ['formk', Key('tab')], - 'chop': ['forek', Key('tab')], - 'eagles': ['?=', Key('tab')], - 'if': ['if', Key('tab')], - 'if markup': ['ifm', Key('tab')], - 'else if': ['elif', Key('tab')], - 'else if markup': ['elifm', Key('tab')], - 'else': ['else', Key('tab')], - 'else markup': ['elsem', Key('tab')], + 'breakpoint': foundation_breakpoint(), 'complete': Key('cmd-shift-enter'), 'definition': Key('alt-space'), diff --git a/pycharm.py b/pycharm.py index 71515d3..a6e8a6f 100644 --- a/pycharm.py +++ b/pycharm.py @@ -8,6 +8,7 @@ # Basic Python f'{PYTHON} self': 'self', f'{PYTHON} from': 'from ', + f'{PYTHON} raise': 'raise ', f'{PYTHON} import': 'import ', f'{PYTHON} break': 'break', f'{PYTHON} continue': 'continue', @@ -27,10 +28,10 @@ f'{PYTHON} in it': ['def __init__(self, ):', Key('left left')], # list methods + f'{PYTHON} pop': ['pop()', Key('left')], f'{PYTHON} append': ['append()', Key('left')], f'{PYTHON} count': ['count()', Key('left')], f'{PYTHON} index': ['index()', Key('left')], - f'{PYTHON} pop': ['pop()', Key('left')], f'{PYTHON} insert': ['insert()', Key('left')], f'{PYTHON} remove': ['remove()', Key('left')], f'{PYTHON} extend': ['extend()', Key('left')], @@ -43,4 +44,5 @@ ctx.keymap(keymap) -def unload(): ctx.unload() \ No newline at end of file +def unload(): ctx.unload() +