Skip to content

Commit

Permalink
added commands for php and python
Browse files Browse the repository at this point in the history
  • Loading branch information
TestPlan committed Sep 25, 2018
1 parent d477bcf commit 293093c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 25 deletions.
59 changes: 36 additions & 23 deletions php-storm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')

Expand Down Expand Up @@ -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')

Expand All @@ -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
Expand All @@ -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)': '<?php ',
'(end flip | end phiz | end 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(),
Expand Down Expand Up @@ -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)': '<?php ',
'(end flip | end phiz | end 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'),

Expand Down
6 changes: 4 additions & 2 deletions pycharm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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')],
Expand All @@ -43,4 +44,5 @@
ctx.keymap(keymap)


def unload(): ctx.unload()
def unload(): ctx.unload()

0 comments on commit 293093c

Please sign in to comment.