コード例 #1
0
 def _lisp(self, extras={}):
     words = extras['words']
     for w in words:
         if w in UnitList:
             Mark()(extras)
             Key("c-w")()
             return
     else:
         Key("c-w")()
         return
コード例 #2
0
ファイル: Chrome.py プロジェクト: sboosali/mandimus
 def __call__(self, extras={}):
     text = self.data
     if self.data:
         text += " "
     # go to address bar, deleting existing text
     (Key("c-l, c-a, backspace")
      # enter the text
      + Text(text + (" %(text)s"))
      # delete any autocomplete results off the end and enter
      + Key("delete, enter"))(extras)
コード例 #3
0
ファイル: PedalConfig.py プロジェクト: sboosali/mandimus
def pedalWindowCb(pedalStates, changed):
    log.info("cb: [%s] [%s]" % (pedalStates, changed))
    pedalKeys = [Key("ca-h"), cyclePedals, Key("ca-e")]
    if pedalStates[0] and not pedalStates[1] and changed == 1:
        Key("ca-backspace")()
    elif pedalStates[0] and not pedalStates[2] and changed == 2:
        Key("ca-space")()
    elif pedalStates[1] and not pedalStates[2] and changed == 2:
        Key("csa-rbracket")()
    elif not pedalStates[changed] and _lastPedal == changed:
        pedalKeys[changed]()
    global _lastPedal
    _lastPedal = changed
コード例 #4
0
    def __call__(self, extras):
        log.info("extras: [%s]" % (extras,))
        words = extras['words']
        log.info('w: ' + str(words))
        keystring = []
        foundModifier = True

        if self.force_shift and "sky" not in words:
            words = ["sky"] + words

        repetitions = extras['i']
        if "control" in words:
            keystring.append('c')
            foundModifier = True
        if "alt" in words:
            keystring.append('a')
            foundModifier = True
        if "sky" in words:
            keystring.append('s')
            foundModifier = True

        if foundModifier:
            keystring.append('-')

        keystring.append(lookup(extras["charrule"], keyNames=True))
        for r in range(repetitions):
            Key(''.join(keystring))()
コード例 #5
0
 def _lisp(self, extras={}):
     words = extras['words']
     for w in words:
         if w in UnitList:
             Mark()(extras)
     Key("a-semicolon")()
     return ""
コード例 #6
0
 def _lisp(self, extras={}):
     words = extras['words']
     for w in words:
         if w in UnitList:
             return "(md-mark-thing '%s)" % w
     Key("c-space")()
     return ""
コード例 #7
0
ファイル: Shell.py プロジェクト: sboosali/mandimus
    "unsetopt",
    ["/usr/bin/", "user bin"],
    "up",
    "valgrind",
    "wait",
    ["wc", "word count"],
    "which",
    "while",
    ["xargs", "X args"],
    ["zsh", "Z shell"],
    "crontab",
    "sleep",
    "time",
    [">", "stood out"],
    ["2>", "stood err"],
    ["&>", "stood both"],
]

ShellKeywordRule = KeywordRule(["shell-mode", "sh-mode"], _keywords)

_mapping = {
    "back [<i>]": Key("b,enter") * Repeat(extra="i"),
    "forward [<i>]": Key("f,enter") * Repeat(extra="i"),
    "surface [<i>]": (EmacsText("up") + Key("enter")) * Repeat(extra="i"),
}

ShellRule = makeContextualRule("Shell", _mapping, emacsExtras, emacsDefaults)
ShellRule.context.addRequirement(IsEmacs)
ShellRule.context.addRequirement(
    ModeRequirement(modes=["shell-mode", "sh-mode"]))
コード例 #8
0
from Actions import Key
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults
from rules.emacs.Cmd import Cmd
from rules.emacs.Text import EmacsText

_mapping = {
    "prior [<i>]": Key("a-p:%(i)d"),
    "future [<i>]": Key("a-n:%(i)d"),
    "history": Key("a-r"),
    "interrupt": Key("c-c,c-c"),
    "exit": Key("c-d"),
    "prompt up [<n>]": Key("c-c,c-p:%(n)d"),
    "prompt down [<n>]": Key("c-c,c-n:%(n)d"),
}

ComintRule = makeContextualRule("Comint", _mapping, emacsExtras, emacsDefaults)
ComintRule.context.addRequirement(IsEmacs)
ComintRule.context.addRequirement(ModeRequirement(modes="comint-mode"))
コード例 #9
0
ファイル: XMonad.py プロジェクト: sboosali/mandimus

_extras = [
    Integer("n", 3, 100),
    Integer("d", 0, 10),
    Integer("i", 3, 8),
]

_defaults = {
    "n": 1,
    "i": 1,
}

# put the more dangerous stuff by itself
_mapping  = {
    "destroy window"                : Key("ca-x"),
    "restart window manager"        : Key("csa-q"),
    "launch emacs"                  : Key("csa-w"),
}

XMonadIndependentRule = makeContextualRule("XMonadIndependent", _mapping, _extras, _defaults, ruleType=RuleType.INDEPENDENT)
XMonadIndependentRule.activate()

_mapping  = {
    # "mon (one | left)"            : Key("ca-up"),
    # "mon (two | middle | center)" : Key("ca-left"),
    # "mon (three | right)"         : Key("ca-right"),
    # "move mon one [<i>]"          : Key("csa-up:%(i)d"),
    # "move mon two [<i>]"          : Key("csa-left:%(i)d"),
    # "move mon three [<i>]"        : Key("csa-right:%(i)d"),
    "East [<i>]"                    : Key("ca-space:%(i)d"),
コード例 #10
0
ファイル: Racket.py プロジェクト: sboosali/mandimus
    ["cdr", "could-er"],
    ["let*", "let star"],
    ["let*-values", "let star values"],
    ["require/typed", "typed require"],
    ["set!", "set"],
    "raise",
    "String",
    "unless",
    ["s-exp", "sexp"],
    ["#%%module-begin", "module begin"],
    "this",
]

RacketKeywordRule = KeywordRule(["racket-mode", "racket-repl-mode"], keywords)

_mapping = {
    "send buff": Key("c-c,c-c"),
    "send region": Key("c-c,c-r"),
    "interpreter": Key("c-c,c-z"),
    "help racket": Key("c-c,c-d"),
    "macro expand": Key("c-c,c-e,e"),
    "macro again": Key("c-c,c-e,a"),
    "macro region": Key("c-c,c-e,r"),
    "macro definition": Key("c-c,c-e,x"),
}

RacketRule = makeContextualRule("Racket", _mapping, emacsExtras, emacsDefaults)
RacketRule.context.addRequirement(IsEmacs)
RacketRule.context.addRequirement(
    ModeRequirement(modes=["racket-mode", "racket-repl-mode"]))
コード例 #11
0
ファイル: ERC.py プロジェクト: sboosali/mandimus
IsErcMode = ModeRequirement(modes="erc-mode")

_mapping = {
    "slash join [<text>]": EmacsText("/join #%(text)s"),
    "slash me [<text>]": EmacsText("/me %(text)s"),
}

ERCTextRule = makeContextualRule("ERCText",
                                 _mapping,
                                 emacsExtras,
                                 emacsDefaults,
                                 ruleType=RuleType.TERMINAL)
ERCTextRule.context.addRequirement(IsEmacs)
ERCTextRule.context.addRequirement(IsErcMode)

_mapping = {
    "prior": Key("a-p"),
    "future": Key("a-n"),
    "smiley wink": EmacsText(";)"),
    "smiley tongue": EmacsText(":P", lower=False),
    "smiley wink tongue": EmacsText(";P", lower=False),
    "slash part": EmacsText("/part"),
    "kick dragon": EmacsText("/me kicks Dragon"),
    "slash message": EmacsText("/msg"),
    "slash whois": EmacsText("/whois"),
}

ERCRule = makeContextualRule("ERC", _mapping, emacsExtras, emacsDefaults)
ERCRule.context.addRequirement(IsEmacs)
ERCRule.context.addRequirement(IsErcMode)
コード例 #12
0
ファイル: Cmd.py プロジェクト: sboosali/mandimus
    def __call__(self, extras={}):
#        Key("a-x")()
        Key("c-c,m,x")() # guaranteed to not use helm
        Text(self.data % extras)()
        Key("enter")()
コード例 #13
0
ファイル: Nav.py プロジェクト: sboosali/mandimus
from rules.emacs.Cmd import CharCmd, Cmd
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from rules.emacs.common import emacsExtras, emacsDefaults
from Actions import Key

# TODO: vertical versions of commands? could be handy for navigation to have
# a jump that considers vertical to cost 0 and horizontal to cost normal,
# so you could say whatever mike to go from the closing brace to mapping.

# TODO: maybe different commands for letters vs. symbols? help break up
# possibilities?

_mapping = {
    "home":
    Key("home"),
    "edge":
    Key("end"),
    "top side":
    Key("a-langle"),
    "bottom":
    Key("a-rangle"),
    "pro [<n>]":
    Key("a-f:%(n)d"),
    "per [<n>]":
    Key("a-b:%(n)d"),
    "over [<n>]":
    Cmd("(forward-symbol 1)"),
    "under [<n>]":
    Cmd("(forward-symbol -1)"),
    "leaf [<n>]":
コード例 #14
0
 def _noChoice(self):
     (Key("c-c") + Key("z"))()
コード例 #15
0
ファイル: Org.py プロジェクト: sboosali/mandimus
from Actions import Key, Repeat
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults

_mapping = {
    "org save link"   : Key("c-c,l"),
    "org agenda menu" : Key("c-c,a"),
    "org agenda"      : Key("c-c,a,a"),
    "org list to do"  : Key("c-c,a,t"),
}

OrgAnywhereRule = makeContextualRule("OrgAnywhere", _mapping, emacsExtras, emacsDefaults)
OrgAnywhereRule.context.addRequirement(IsEmacs)


# "scoot" -> expand section
# "cap scoot" -> collapse all sections
# "lima" -> log view to see record for the day
_mapping = {
    "new"                     : Key("a-enter"),
    "new todo"                : Key("as-enter"),
    "make headline"           : Key("c-c,asterisk"),
    "make table"              : Key("c-c,bar"),
    "archive [<i>]"           : Key("c-c,c-t,c-a") * Repeat(extra="i"),
    "task [<i>]"              : Key("c-c,c-x") * Repeat(extra="i"),
    "follow"                  : Key("c-c,c-o"),
    "insert link"             : Key("c-c,c-l"),
    "schedule"                : Key("c-c,c-s"),
    "increase priority [<i>]" : Key("s-up:%(i)d"),
コード例 #16
0
 def _noChoice(self):
     Key("c-z")()
コード例 #17
0
ファイル: Sql.py プロジェクト: sboosali/mandimus
keywords = [
    ["SELECT", "select"],
    ["FROM", "from"],
    ["ORDER BY", "order by"],
    ["DESC", "descending"],
    ["ASC", "ascending"],
    ["GROUP BY", "group by"],
    ["LIMIT", "limit"],
    ["WHERE", "where"],
    ["JOIN", "join"],
    ["MERGE", "merge"],
    ["COUNT", "count"],
    ["INSERT", "insert"],
    ["INTO", "INTO"],
    ["DISTINCT", "distinct"],
]

SqlKeywordRule = KeywordRule(["sql-mode", "sql-interactive-mode"], keywords)

_mapping = {
    "history": Key("a-r"),
    "interrupt": Key("c-c,c-c"),
    "exit": Key("c-d"),
    "prompt up [<n>]": Key("c-c,c-p:%(n)d"),
    "prompt down [<n>]": Key("c-c,c-n:%(n)d"),
}

SqlRule = makeContextualRule("Sql", _mapping, emacsExtras, emacsDefaults)
SqlRule.context.addRequirement(IsEmacs)
SqlRule.context.addRequirement(ModeRequirement(modes="sql-interactive-mode"))
コード例 #18
0
ファイル: CUA.py プロジェクト: jgarvin/mandimus
from Actions import Key, Text
from protocol import Integer, Dictation, RuleType
from requirements.Emacs import NotEmacs
from requirements.Terminal import NotTerminal
from rules.emacs.Cmd import CharCmd
from rules.ContextualRule import makeContextualRule

_mapping = {
    "copy": Key("c-c"),
    "cut": Key("c-x"),
    "paste": Key("c-v"),
    "term paste": Key("s-insert"),
    "select all": Key("c-a"),
    "select per": Key("cs-left"),
    "select pro": Key("cs-right"),
    "select home": Key("s-home"),
    "select edge": Key("s-end"),
    "undo": Key("c-z"),
    "redo": Key("c-y"),
    "next form": Key("tab"),
    "previous form": Key("s-tab"),
    "axe": Key("escape"),
    "find": Key("c-f"),
    "find it next [<n>]": Key("F3:%(n)d"),
    "find it previous [<n>]": Key("s-F3:%(n)d"),
    "leaf [<n>]": Key("pgdown:%(n)d"),
    "feel [<n>]": Key("pgup:%(n)d"),
    "home": Key("home"),
    "edge": Key("end"),
    "left [<n>]": Key("left:%(n)d"),
    "right [<n>]": Key("right:%(n)d"),
コード例 #19
0
from Actions import Key
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults

_mapping = {
    "external"          : Key("ampersand"),
}

EwwRule = makeContextualRule("Eww", _mapping, emacsExtras, emacsDefaults)
EwwRule.context.addRequirement(IsEmacs)
EwwRule.context.addRequirement(ModeRequirement(modes="eww-mode"))

コード例 #20
0
                return "(md-mark-thing '%s)" % w
        Key("c-space")()
        return ""

class Comment(Cmd):
    def _lisp(self, extras={}):
        words = extras['words']
        for w in words:
            if w in UnitList:
                Mark()(extras)
        Key("a-semicolon")()
        return ""


_mapping = {
    "command"                     : Key("a-x"),
    "toggle emacs debug"          : Cmd("(toggle-debug-on-error)"),
    "exit debug"                  : Key("c-t,X,a"),
    # "debug function"              : Key("c-t,c-m") + Text("debug-on-entry") + Key("enter"),
    # "cancel debug function"       : Key("c-t,c-m") + Text("cancel-debug-on-entry") + Key("enter"),

    "go to line"                  : Key("a-g,a-g"),
    # "go to line <big>"          : Key("a-g,a-g") + Text("%(big)d") + Key("enter"),

    "new frame"                   : Cmd("(make-frame-command)"),
    "mini buffer"                 : Cmd("(md-select-minibuffer)"),

    "list buffs"                  : Key("c-t,c-b,c-t,o") + Cmd("(ace-jump-line-mode)"),

    # projectile commands
    "switch project"              : Key("c-c,p,p"),
コード例 #21
0
ファイル: Term.py プロジェクト: sboosali/mandimus
from Actions import Key
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults

# Term mode issues:
# -Can wreck prompt and previous output
# -Completion won't work, because we need to emulate moving cursor and pressing TAB

_mapping = {
    "line mode": Key("c-c,c-j"),
    "care mode": Key("c-c,c-k"),
}

TermRule = makeContextualRule("Term", _mapping, emacsExtras, emacsDefaults)
TermRule.context.addRequirement(IsEmacs)
TermRule.context.addRequirement(ModeRequirement(modes="term-mode"))
コード例 #22
0
ファイル: GnuDebugger.py プロジェクト: sboosali/mandimus
from Actions import Key, Repeat
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from requirements.ModeRequirement import ModeRequirement
from requirements.VarRequirement import VarRequirement
#from requirements.Or import OrRequirement
from rules.emacs.common import emacsExtras, emacsDefaults
from rules.emacs.Cmd import Cmd, Minibuf
from rules.emacs.Keywords import KeywordRule

import keyword

_mapping = {
    "track debugger": Minibuf("realgud-track-mode"),
    "debug run": Key("c-c,d"),
    "toggle debugger": Key("c-c,t,d"),
    "toggle valgrind": Key("c-c,t,v"),
    "good source": Key("c-t,c-a,c-l"),
    "set break point": Key("c-t,c-a,c-b"),
    "delete break point": Key("c-t,c-a,c-d"),
    "good step [<i>]": Key("c-t,c-a,c-s") * Repeat(extra="i"),
    "good next [<i>]": Key("c-t,c-a,c-n") * Repeat(extra="i"),
    "good instruction [<i>]": Key("c-t,c-a,c-i") * Repeat(extra="i"),
    "good eval": Key("c-t,c-a,c-p"),
    "good continue": Key("c-t,c-a,c-r"),
    "good up": Key("c-t,c-a,langle"),
    "good down": Key("c-t,c-a,rangle"),
    "good until": Key("c-t,c-a,c-u"),
    "good finish": Key("c-t,c-a,c-f"),
    "good jump": Key("c-t,c-a,c-j"),
コード例 #23
0
ファイル: Python.py プロジェクト: sboosali/mandimus
from Actions import Key
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults
from rules.emacs.Cmd import Cmd
from rules.emacs.Keywords import KeywordRule

import keyword

_mapping = {
    "align hash": Cmd("(align-dict)"),
    "align list": Cmd("(align-list)"),
    "mark block": Cmd("(er/mark-python-block)"),
    "mark state": Cmd("(er/mark-python-statement)"),
    "send funk": Key("ca-x"),
    "send buff": Key("c-c,c-c"),
    "send region": Key("c-c,c-r"),
    "interpreter": Key("c-c,c-z"),
}

PythonRule = makeContextualRule("Python", _mapping, emacsExtras, emacsDefaults)
PythonRule.context.addRequirement(IsEmacs)
PythonRule.context.addRequirement(
    ModeRequirement(modes=["python-mode", "inferior-python-mode"]))

keywords = [
    "True", "False", "set", "list", "dict", "None", "self", "print", "object",
    "len", "reversed", "enumerate", "range", ["__init__", "init"], "help",
    "type", ["__name__", "name"], ["str", "stir"],
    "unicode", "dir", "all", "any", ["isinstance", "is instance"],
コード例 #24
0
ファイル: Edit.py プロジェクト: sboosali/mandimus
#         "lesser"   : "'angles",
#     }

#     mapping = {
#         "mark" : "'mark",
#         "cut"  : "'cut",
#         "copy" : "'copy",
#         "dupe" : "'dupe",
#         "swap" : "'swap",
#     }

_mapping = {
    "zap <charrule> [<i>]": CharCmd("(zap-up-to-char 1 %s)"),
    "taze <charrule> [<i>]": CharCmd("(zap-up-to-char -1 %s)"),
    #"fizz <charrule> [<i>]" : CharCmd("(md-copy-up-to-char 1 %s)"),
    #"buzz <charrule> [<i>]" : CharCmd("(md-copy-up-to-char -1 %s)"),
    "trans [<i>]": Key("ca-t"),
    "rise [<n>]": Key("a-up:%(n)d"),
    "drop [<n>]": Key("a-down:%(n)d"),
    #"var <charrule> [<n>]"  : CharCmd("(md-insert-text (char-to-string %s) t nil)"),
    "homophone": Cmd("(md-cycle-homophones-at-point)"),
    "sort lines": Cmd("(call-interactively #'sort-lines)"),
    "make score": Key("c-c,m,s"),
    "make stud": Key("c-c,m,c"),
    "make camel": Key("c-c,m,l"),
    "make upper": Key("c-c,m,u")
}

EditRule = makeContextualRule("Edit", _mapping, emacsExtras, emacsDefaults)
EditRule.context.addRequirement(IsEmacs)
コード例 #25
0
ファイル: Always.py プロジェクト: jgarvin/mandimus
 def __call__(self, extras={}):
     for word in extras['letters']['words']:
         Key(AlphaRule.rule.mapping[word])()
コード例 #26
0
ファイル: Eshell.py プロジェクト: sboosali/mandimus
    "up",
    "valgrind",
    "wait",
    ["wc", "word count"],
    "which",
    "while",
    ["xargs", "X args"],
    ["zsh", "Z shell"],
    "crontab",
    "sleep",
    [">", "stood out"],
    ["2>", "stood err"],
    ["&>", "stood both"],
]

EShellKeywordRule = KeywordRule(["eshell-mode"], _keywords)

_mapping = {
    "back [<i>]": Key("b,enter") * Repeat(extra="i"),
    "forward [<i>]": Key("f,enter") * Repeat(extra="i"),
    "surface [<i>]": (EmacsText("up") + Key("enter")) * Repeat(extra="i"),
    "history": Key("a-r"),
    "interrupt": Key("c-c,c-c"),
    "prompt up [<n>]": Key("c-c,c-p:%(n)d"),
    "prompt down [<n>]": Key("c-c,c-n:%(n)d"),
}

EShellRule = makeContextualRule("Shell", _mapping, emacsExtras, emacsDefaults)
EShellRule.context.addRequirement(IsEmacs)
EShellRule.context.addRequirement(ModeRequirement(modes=["eshell-mode"]))
コード例 #27
0
ファイル: Always.py プロジェクト: jgarvin/mandimus
from rules.BaseRules import AlphaRule, DigitRule, SymRule, CharRule, PressKey
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import NotEmacs
from EventList import RuleActivateEvent
import string
from protocol import Integer, Dictation, RuleRef, Repetition, RuleType


# class PrintLetter(object):
#     def __call__(self, extras):
#         log.info("Heard letter! %s" % extras['words'])

_mapping = {
    'rep [<n>]'                              : RepeatPreviousAction(),
    "[control] [alt] [sky] <charrule> [<i>]" : PressKey(),
    'scoot [<i>]'                            : Key("tab:%(i)d"),
    'cap scoot [<i>]'                        : Key("s-tab:%(i)d"),
    'greek alpha' : Text("alpha"),
    'greek alphas' : Text("alphas"),
    "click left" : click(1),
    "click middle" : click(2),
    "click right" : click(3)
}

_extras = [
    Integer("i", 3, 8),
    Integer("n", 3, 72),
    Integer("digit", 0, 10),
    Dictation("text"),
    RuleRef(AlphaRule, "alpharule"),
    RuleRef(CharRule, "charrule"),
コード例 #28
0
from Actions import Key
from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from requirements.ModeRequirement import ModeRequirement
from rules.emacs.common import emacsExtras, emacsDefaults
from rules.emacs.Cmd import Minibuf
from protocol import RuleType

_mapping = {
    "refresh": Key("g"),
    "stage": Key("s"),
    "unstage": Key("u"),
    "commit": Key("c"),
    "done": Key("q"),
    "level one": Key("a-1"),
    "level two": Key("a-2"),
    "level three": Key("a-3"),
    "level four": Key("a-4"),
    "more context": Key("plus"),
    "less context": Key("hyphen"),
    "discard": Key("k"),
    "branch": Key("b"),
    "merge": Key("m"),
    "diff": Key("d"),
    "push": Key("P"),
    "push remote": Key("c-u,P"),
    "remote update": Key("f"),
    "pull": Key("F"),
}

## Turns out that since these are all single letter triggered,
コード例 #29
0
ファイル: joystick.py プロジェクト: jgarvin/mandimus
buttons = ButtonContainer()
buttons.Start = JoyButton("ABS_Y", 255)
buttons.Select = JoyButton("BTN_BASE4")
buttons.Center = JoyButton("BTN_TOP2")
buttons.LeftUp = JoyButton("BTN_BASE")
buttons.RightUp = JoyButton("BTN_BASE2")
buttons.LeftDown = JoyButton("BTN_BASE3")
buttons.RightDown = JoyButton("BTN_PINKIE")
buttons.Up = JoyButton("BTN_TRIGGER")
buttons.Down = JoyButton("BTN_THUMB")
buttons.Left = JoyButton("BTN_THUMB2")
buttons.Right = JoyButton("BTN_TOP")

joystick_actions = {
    buttons.Start:
    Key("c-g", delay=0, style="hold"),
    buttons.Select:
    Key("c-g", delay=0, style="hold"),

    # too easy to hit by accident
    buttons.Center:
    None,
    # buttons.Left + buttons.Center  : Key("enter", delay=0),
    # buttons.Right + buttons.Center : Key("space", delay=0),
    buttons.Left + buttons.LeftUp:
    Key("ca-h", delay=0),
    buttons.Left + buttons.RightUp:
    Key("ca-e", delay=0),
    buttons.Right + buttons.LeftUp:
    Key("ca-backspace", delay=0),
    buttons.Right + buttons.RightUp:
コード例 #30
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from rules.ContextualRule import makeContextualRule
from requirements.Emacs import IsEmacs
from rules.emacs.common import emacsExtras, emacsDefaults
from Actions import Key
from protocol import RuleType

_mapping = {
    "build menu": Key("c-u,c-c,b"),
    "run menu": Key("c-u,c-c,r"),
    "build only": Key("c-c,b"),
    "stop build": Key("c-c,s,b"),
    "stale run": Key("c-c,r"),
    "stop run": Key("c-c,s,r"),
    "execute": Key("c-c,c"),
    "new build script": Key("c-c,n,b"),
    "new run script": Key("c-c,n,r"),
    "open build script": Key("c-c,o,b"),
    "open run script": Key("c-c,o,r"),
}

BuildRule = makeContextualRule("Build",
                               _mapping,
                               emacsExtras,
                               emacsDefaults,
                               ruleType=RuleType.TERMINAL)
BuildRule.context.addRequirement(IsEmacs)