コード例 #1
0
from talon.voice import Context, Key
from user.utils import is_filetype
import time

exts = (".py")

context = Context("python", func=is_filetype(exts))

py_map = {
    'snip  escapist':
    'esc',
    'auto flake':
    Key("cmd-esc space m r i"),
    'references':
    [Key('cmd-esc , g u'), lambda x: time.sleep(0.3),
     Key("space j l")],
    'jump':
    Key('cmd-esc , g g'),
    'live mode':
    Key('cmd-esc space m l'),
    'bevel':
    Key('cmd-esc space m c c'),
    # 'bevel': Key('xxx'),
    'format':
    Key('cmd-esc space m = ='),
    'snip  commander':
    'cmd-esc',
}

context.keymap(py_map)
コード例 #2
0
import sys

from talon.engine import engine
from talon.voice import Context, Key
from user.emacs.utils import elisp, key_repeat
from user.utils import is_filetype, numerals

exts = ("*mu4e", "Re: ", ".orgx")

context = Context("mu4e", func=is_filetype(exts))

mu4e_map = {
    "reply": [Key('R')],
    "new message": lambda x: elisp("(mu4e-compose-new)"),
}  

toggle_map = {
        "edit mode": lambda x: activate(),
        "pros mode": lambda x: deactivate(),
}

dictation_map = {
    "center": [Key('cmd-esc z z') ],
    "down" + numerals: lambda x: key_repeat(x,1, "j"),
    "up" + numerals: lambda x: key_repeat(x, 1,"k"),
}

def deactivate():
    context.unload()
    engine.mimic("talon deactivate emacs map".split())
    engine.mimic("talon deactivate standard map".split())
コード例 #3
0
from talon.voice import Context, Key
from user.utils import is_filetype

exts = (".clj")

context = Context("clojure", func=is_filetype(exts))

clojure_map = {
    "ripple connect": [Key('cmd-esc space m s i')],
    "format": [Key('cmd-esc space m =')],
    "( bevel | evaluate buffer )": [Key('esc , e b')],
    # expressions
    "sexy": [Key('cmd-esc space k k right i')],
    "sex": [Key('cmd-esc space k j right i')],
    "raise": [Key('cmd-esc space k r i')],
    "splice": [Key('cmd-esc space k E i')],
    "barf back": [Key('esc space k B i')],
    "barf": [Key('esc space k b i')],
    "slurp": [Key('esc space k s i')],
    "slurp back": [Key('esc space k S i')],
    "sex above": [Key('cmd-esc space k (')],
    "sex below": [Key('cmd-esc space k )')],
    "sex delete": [Key('cmd-esc space k d x esc i')],
    "sex rap": [Key('esc space k w esc')],
    "sex comment": [Key('esc ctrl-alt-space alt-;')],
    "sex isolate": [Key('esc ctrl-alt-space alt-; alt-;')],
    # "eve": [Key('cmd-esc , e b')],
    "jump": [Key('cmd-esc space m g g')],
    "eve region": [Key('cmd-esc , e r')],
    "evelyn": [Key('cmd-esc , e l')],
    "saver": [Key('cmd-esc f s cmd-esc , e b')],
コード例 #4
0
ファイル: helm.py プロジェクト: justin-roche/spacemacs-talon
from talon.voice import Context, Key, Str, press
from user.utils import is_filetype, numerals, text_to_number

exts = ("*Minibuf", ".orgx")

context = Context("helm", func=is_filetype(exts))


def helm_select(x):
    n = text_to_number(x._words[1:])
    press("ctrl-c")
    Str(str(n))(None)


def on_noise(noise):
    if noise == 'pop':
        press("enter")


# noise.register('noise', on_noise)

helm_map = {
    "down" + numerals: lambda x: helm_select(x),
    "hat" + numerals: lambda x: helm_select(x),
    "copy": Key("ctrl-c ctrl-k"),
}

context.keymap(helm_map)
コード例 #5
0
from talon.voice import Context, Key
from user.emacs.utils import elisp
from user.utils import is_filetype

exts = (".el", ".orgx")

context = Context("elisp", func=is_filetype(exts))

lisp_map = {
    "sex above": [Key('cmd-esc space k (')],
    "sex below": [Key('cmd-esc space k )')],
    "sex delete": [Key('cmd-esc space k d x esc i')],
    "sex rap": [Key('esc space k w esc')],
    "sex rap": [Key('esc space k w esc')],
    "sex comment": [Key('esc ctrl-alt-space alt-;')],
    "sex isolate": [Key('esc ctrl-alt-space alt-; alt-;')],
    "slurp": [Key('esc space k s')],
    "jump": [Key('cmd-esc space m g g')],
    "barf": [Key('esc space k b')],
    # evaluation
    "evaluate buffer": [Key('esc , e b')],
    "eve region": [Key('cmd-esc , e r')],
    "evelyn": [Key('cmd-esc , e l')],
    "eve": [Key('cmd-esc , e b')],
    "saver": [Key('cmd-esc f s cmd-esc , e b')],
    # "debug break": lambda x: elisp("(edebug-x-modify-breakpoint-wrapper t)"),
    # "debug break": lambda x: elisp("(edebug-set-breakpoint t)"),
    "show breakpoints":
    lambda x: elisp("(edebug-x-show-breakpoints)"),
    "debug break": [
        lambda x: elisp("(spacemacs/edebug-instrument-defun-on)"),
コード例 #6
0
from talon.voice import Context, Key, press
from user.emacs.utils import elisp, key_repeat
from user.utils import is_filetype, numerals

exts = ("*NeoTree*", "*Treemacs")

context = Context("tree", func=is_filetype(exts))

tree_map = {
    "open": [Key('ctrl-l ')],
    "tree path":
    lambda x: elisp("(treemacs-copy-path-at-point)"),
    "workspace":
    lambda x: elisp("(treemacs-edit-workspaces)"),
    "tree shell":
    lambda x: elisp("(treemacs-shell)"),
    # "tree project":
    # lambda x: elisp("(treemacs-projectile)"),
    # "center": [Key('ctrl-l')],
    "last pro":
    lambda x: elisp("(treemacs-previous-project)"),
    "next pro":
    lambda x: elisp("(treemacs-next-project)"),
    "sin": [Key('ctrl-l')],
    "parent": [
        lambda x: elisp("(treemacs-goto-parent-node)"),
        lambda x: elisp("(evil-scroll-line-to-center nil)")
    ],
    "last": [
        lambda x: elisp("(treemacs-previous-neighbour)"),
        lambda x: elisp("(evil-scroll-line-to-center nil)")
コード例 #7
0
ファイル: shell.py プロジェクト: justin-roche/spacemacs-talon
import time

from talon.voice import Context, Key
from user.utils import is_filetype

exts = ("*shell*", ".orgx")

context = Context("shell", func=is_filetype(exts))

shell_map = {
    "shell start": [Key('cmd-esc space b S')],
    "which":
    "which ",
    "pseudo":
    "sudo ",
    "echo":
    "echo ",
    "path":
    "$PATH",
    "shell quit":
    [Key('esc space m x esc'), lambda x: time.sleep(.5),
     Key('G a')],
    "shell repeat": [Key('up')],
    "shell root": [Key('esc p !')],
    "em install": ['npm install', Key('enter')],
    "em all": ['npm run all:prod', Key('enter')],
    "em save": ['npm install --save '],
    "em test": ['npm test', Key('enter')],
    "em start": [
        Key('esc'), 'G0', 'i',
        Key('ctrl-c'),
コード例 #8
0
from talon.voice import Context, Key

from user.utils import is_filetype, numerals
from user.emacs.utils import key_repeat, elisp

exts = ("magit:", "COMMIT_EDITMSG")

context = Context("git", func=is_filetype(exts))

git_map = {
    "get init": lambda x: elisp("(magit-init)"),
    "get finalize ": [Key('alt-m g f')],
    "sin": [Key('ctrl-l')],
    "down": Key('cmd-esc ctrl-n'),
    "up": Key('cmd-esc ctrl-p'),
    "up" + numerals: lambda x: key_repeat(x, 1, ["ctrl-p"]),
    "down" + numerals: lambda x: key_repeat(x, 1, ["ctrl-n"]),
    "center": [Key('ctrl-l')],
    "test": [Key('space')],
    "save": [Key('ctrl-c ctrl-c')],
    "cancel": [Key('ctrl-c ctrl-k')],
}

context.keymap(git_map)