Skip to content

Commit

Permalink
added commands for youtube, visual studio code, and php snippets for …
Browse files Browse the repository at this point in the history
…phpstorm
  • Loading branch information
TestPlan committed Aug 22, 2018
1 parent e39c53a commit 2c832d0
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 21 deletions.
48 changes: 37 additions & 11 deletions google-chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ def search(m):
press('cmd-m')


def quit(m):
press('cmd-q')


def scroll_to_top(m):
press('g')
press('g')
Expand All @@ -58,7 +54,7 @@ def refocus_page(m):
focus_address_bar(None)

# Escape button
# This leaves the focus on the page at previous tab focused point, not the beginning of the page
# This leaves the focus on the page at previous tab focused point, not t_he beginning of the page
press('escape')


Expand All @@ -83,14 +79,45 @@ def jump_tab(m):
'search': search,
'print': print_page,
'top': scroll_to_top,
'quit': quit,

# youtube
# disable vimium for youtube shortcuts to work
'(play | pause)': Key('k'),
'movie mode': Key('f'),
'[toggle] theater mode': Key('t'),
'restart video': Key('home'),
'end video': Key('end'),
'volume down': Key('down'),
'volume up': Key('up'),
'(mute | unmute)': Key('m'),
'video search': Key('/'),
'slow down': Key('<'),
'speed up': Key('>'),
'(jump | forward) ten': Key('l'),
'(jump | forward) five': Key('right'),
'back ten': Key('j'),
'back five': Key('left'),

# not working
'previous video': Key('P'),
'next video': Key('shift-n'),
'(toggle captions | toggle caption)': Key('c'),

'back[ward]': back,
'forward': forward,
'reload': Key('cmd-r'),
'hard reload': Key('cmd-shift-r'),
'bookmark': Key('cmd-d'),
'toggle bookmark [bar]': Key('cmd-shift-b'),
'bookmark manager': Key('cmd-alt-b'),
'downloads': Key('cmd-shift-j'),
'add extras': Key('ctrl-enter'),
'add extras new': Key('ctrl-shift-enter'),

'new tab': Key('cmd-t'),
'new window': Key('cmd-n'),
'close window': Key('cmd-shift-w'),
'(incognito | incog)': Key('cmd-shift-n'),
'close tab': Key('cmd-w'),
'(reopen | unclose) tab': Key('cmd-shift-t'),

Expand All @@ -101,13 +128,15 @@ def jump_tab(m):
'(end | rightmost) tab': Key('cmd-9'),

'find': Key('cmd-f'),
'next': Key('cmd-g'),

'next match': Key('cmd-g'),
'(last | prevous)': Key('cmd-shift-g'),

'clear cash': Key('cmd-shift-backspace'),

# dev tools
'toggle dev tools': Key('cmd-alt-i'),
'command [menu]': Key('cmd-shift-p'),
'(javascript (counsel | console) | javascript (counsel | console) close)': Key('cmd-alt-j'),
'next panel': next_panel,
'(last | prevous) panel': last_panel,
'[show] application [panel]': lambda m: show_panel('Application'),
Expand All @@ -124,8 +153,5 @@ def jump_tab(m):
'[refocus] dev tools': open_focus_devtools,

# Clipboard
'cut': Key('cmd-x'),
'copy': Key('cmd-c'),
'paste': Key('cmd-v'),
'paste same style': Key('cmd-alt-shift-v'),
})
4 changes: 2 additions & 2 deletions jetbrains.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from talon.voice import Context, Key

ides = {
ides = [
"com.jetbrains.intellij",
"com.jetbrains.intellij.ce",
"com.jetbrains.AppCode",
Expand All @@ -13,7 +13,7 @@
"com.jetbrains.rubymine",
"com.jetbrains.WebStorm",
"com.google.android.studio",
}
]


ctx = Context('phpstorm', func=lambda app, win: any(
Expand Down
18 changes: 14 additions & 4 deletions php-storm.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
from talon.voice import Context, Key

ides = {
ides = [
"com.jetbrains.PhpStorm",
}
]


ctx = Context('phpstorm', func=lambda app, win: any(
i in app.bundle for i in ides))

keymap = {
'(phiz | fizz)': ['php', 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')],
'bat': ['?=', 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')],
'complete': Key('cmd-shift-enter'),
'definition': Key('alt-space'),
}
Expand Down
14 changes: 11 additions & 3 deletions std.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def rot13(i, word, _):
'snake': (True, lambda i, word, _: word if i == 0 else '_'+word),
'smash': (True, lambda i, word, _: word),
# spinal or kebab?
'kebab': (True, lambda i, word, _: word if i == 0 else '-'+word),
'truck': (True, lambda i, word, _: word if i == 0 else '-'+word),
# 'sentence': (False, lambda i, word, _: word.capitalize() if i == 0 else word),
'title': (False, lambda i, word, _: word.capitalize()),
'allcaps': (False, lambda i, word, _: word.upper()),
Expand Down Expand Up @@ -196,6 +196,10 @@ def FormatText(m):
'new folder': Key('shift-cmd-n'),
'(settings | preferences)': Key('cmd-,'),
'trash': Key('cmd-delete'),
'(show desktop | toggle desktop | hide desktop)': Key('f11'),
'windows mode': Key('ctrl-down'),
'reverse': Key('tab'),
'advance': Key('`'),

# Finder
'documents': Key('shift-cmd-o'),
Expand All @@ -217,8 +221,8 @@ def FormatText(m):
'start': Key('cmd-left'),
'end': Key('cmd-right'),
'(top | go to top)': Key('cmd-up'),
'flip': Key('fn-up'),
'flop': Key('fn-down'),
'page up': Key('pageup'),
'page down': Key('pagedown'),
'jump [right] word': Key('alt-right'),
'jump left word': Key('alt-left'),

Expand Down Expand Up @@ -289,6 +293,10 @@ def FormatText(m):
'run (them | vim)': 'vim ',
'run L S': 'ls\n',
'dot pie': '.py',
'dot Jay Es': '.js',
'dot Sea EsEs': '.css',
'(dot flip | dot P H P)': '.php',
'(dot sass | dot sassy)': '.scss',
'run make': 'make\n',
'run jobs': 'jobs\n',

Expand Down
5 changes: 4 additions & 1 deletion vs-code.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def jump_to_next_word_instance(m):
# Navigating text
'pizza (0 | oh | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)+': jump_to_line,


'[toggle] terminal': Key('alt-f12'),

# Selecting text
'select line': Key('cmd-right cmd-shift-left'),
Expand All @@ -56,5 +56,8 @@ def jump_to_next_word_instance(m):
'(previous | last)': Key('cmd-shift-g'),
'find next <dgndictation>': jump_to_next_word_instance,

'(dupe | duplicate)': Key('cmd-d'),



})

0 comments on commit 2c832d0

Please sign in to comment.