diff --git a/google-chrome.py b/google-chrome.py index 4d4970d..bef762c 100644 --- a/google-chrome.py +++ b/google-chrome.py @@ -80,6 +80,16 @@ def jump_tab(m): 'search': search, 'print': print_page, 'top': scroll_to_top, + + # shortkeys plugin + 'bottom': Key('ctrl-b'), + 'copy euro': Key('ctrl-u'), + 'google it': Key('ctrl-g'), + 'move tab left': Key('ctrl-l'), + 'move tab right': Key('ctrl-r'), + + + 'clear': [Key('cmd-a'), Key('backspace')], # youtube diff --git a/php-storm.py b/php-storm.py index 232f3d4..4acbd5d 100644 --- a/php-storm.py +++ b/php-storm.py @@ -59,6 +59,14 @@ def blade_if_function(m): return blade_if_function +def blade_else(): + def blade_else_function(m): + Str('@else')(None) + press('return') + + return blade_else_function + + def blade_section(): def blade_section_function(m): Str('@section(\'\')')(None) @@ -90,14 +98,6 @@ def blade_if_else_function(m): return blade_if_else_function -def blade_else(): - def blade_else_function(m): - Str('@else')(None) - press('return') - - return blade_else_function - - def blade_php(): def blade_php_function(m): Str('@php @endphp')(None) @@ -126,13 +126,13 @@ def blade_include_function(m): 'blade include': blade_include(), 'blade else': blade_else(), 'blade for each': blade_for_each(), + 'blade section': blade_section(), 'blade data': '{{ ', 'blade continue': '@continue', 'blade break': '@break', 'blade parent': '@parent', 'blade case': ['@case()', Key('left')], 'blade extends': ['@extends(\'\')', Key('left'), Key('left')], - 'blade section': blade_section(), 'blade loop': '$loop', 'blade raw data': '{!', @@ -145,6 +145,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')], diff --git a/pycharm.py b/pycharm.py new file mode 100644 index 0000000..71515d3 --- /dev/null +++ b/pycharm.py @@ -0,0 +1,46 @@ +from talon.voice import Context, Key, Str, press + +ctx = Context('pycharm', func=lambda app, win: app.bundle == 'com.jetbrains.pycharm') + +PYTHON = '[(pie | pi | py | python)]' + +keymap = { + # Basic Python + f'{PYTHON} self': 'self', + f'{PYTHON} from': 'from ', + f'{PYTHON} import': 'import ', + f'{PYTHON} break': 'break', + f'{PYTHON} continue': 'continue', + f'{PYTHON} return': 'return ', + f'{PYTHON} jason': 'json', + f'{PYTHON} true': 'True', + f'{PYTHON} false': 'False', + f'{PYTHON} none': 'None', + f'{PYTHON} if': ['if :', Key('left')], + f'{PYTHON} else': ['else :', Key('left')], + f'{PYTHON} else if': ['elif :', Key('left')], + f'{PYTHON} while': ['while :', Key('left')], + f'{PYTHON} for loop': ['for x in :', Key('left')], + f'{PYTHON} print': ['print()', Key('left')], + f'{PYTHON} range': ['range()', Key('left')], + f'{PYTHON} (def | deaf | deft)': ['def :', Key('left')], + f'{PYTHON} in it': ['def __init__(self, ):', Key('left left')], + + # list methods + 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')], + f'{PYTHON} sort': ['sort()', Key('left')], + + # Python: relies on custom PyCharm live templates + f'{PYTHON} class': ['pyclass', Key('tab')], +} + +ctx.keymap(keymap) + + +def unload(): ctx.unload() \ No newline at end of file diff --git a/std.py b/std.py index fef442b..6183369 100644 --- a/std.py +++ b/std.py @@ -207,6 +207,7 @@ def FormatText(m): 'right': Key('right'), 'up': Key('up'), 'down': Key('down'), + 'dot (calm | com)': '.com', 'puter sleep': Key('ctrl-alt-shift-cmd-s'), 'puter down': Key('ctrl-alt-shift-cmd-d'), @@ -215,7 +216,7 @@ def FormatText(m): # 'exit talent': Key('ctrl-alt-shift-cmd-t'), 'delete': Key('backspace'), - + 'slurp': Key('right backspace'), 'run quit': Key('cmd-q'), 'kill': Key('ctrl-c'), 'screenshot page': Key('alt-shift-p'), @@ -378,18 +379,10 @@ def FormatText(m): # 'brace': [' else if ()', Key('left')], # python - 'state (def | deaf | deft)': 'def ', - 'state else if': 'elif ', - 'state if': 'if ', - 'state else if': [' else if ()', Key('left')], - 'state while': ['while ()', Key('left')], - 'state for': ['for ()', Key('left')], - 'state for': 'for ', 'state switch': ['switch ()', Key('left')], 'state case': ['case \nbreak;', Key('up')], 'state goto': 'goto ', 'state import': 'import ', - 'state class': 'class ', 'state include': '#include ', 'state include system': ['#include <>', Key('left')],