Ejemplo n.º 1
0
class FirefoxShortcutRule(MappingRule):
    mapping = {
        "find [<1to100>]": K("escape") + K("slash"),
        "find now <text>": K("escape") + K("slash") + T('%(text)s')
    }
    defaults = {"1to100": 1, "text": ""}
    extras = [chc_base.text, chc_base._1to100]
Ejemplo n.º 2
0
class CharacterRule(MappingRule):
    mapping = {}
    for word in chc_base.alpha_words:
        letter = word[0].lower()
        mapping[word] = K(letter)
        mapping['cap ' + word] = K(letter.upper())
        mapping['insert ' + word] = T(word.lower())
Ejemplo n.º 3
0
class VimCoreRule(MappingRule):
    mapping = {
        "command": K("escape,colon"),
        "closave": K("escape, colon, w, q, enter"),
        "closover": K("escape, colon, w, exclamation, q, enter"),
        "closard": K("escape, colon, q, exclamation, enter")
    }
    defaults = {"text": ""}
    extras = [chc_base.text]
Ejemplo n.º 4
0
class HtmlTemplateRule(MappingRule):
    mapping = {
        "Lorem ipsum [short]":
        K("L,o,r,e,m,space,i,p,s,u,m,space,d,o,l,o,r,space,s,i,t,space,a,m,e,t,comma,space,c,o,n,s,e,c,t,e,t,u,r,space,a,d,i,p,i,s,i,c,i,n,g,space,e,l,i,t,dot"
          ),
        "Lorem ipsum medium":
        K("L,o,r,e,m,space,i,p,s,u,m,space,d,o,l,o,r,space,s,i,t,space,a,m,e,t,comma,space,c,o,n,s,e,c,t,e,t,u,r,space,a,d,i,p,i,s,i,c,i,n,g,space,e,l,i,t,comma,space,s,e,d,space,d,o,space,e,i,u,s,m,o,d,space,t,e,m,p,o,r,space,i,n,c,i,d,i,d,u,n,t,space,u,t,space,l,a,b,o,r,e,space,e,t,space,d,o,l,o,r,e,space,m,a,g,n,a,space,a,l,i,q,u,a,dot,space,U,t,space,e,n,i,m,space,a,d,space,m,i,n,i,m,space,v,e,n,i,a,m,comma,space,q,u,i,s,space,n,o,s,t,r,u,d,space,e,x,e,r,c,i,t,a,t,i,o,n,space,u,l,l,a,m,c,o,space,l,a,b,o,r,i,s,space,n,i,s,i,space,u,t,space,a,l,i,q,u,i,p,space,e,x,space,e,a,space,c,o,m,m,o,d,o,space,c,o,n,s,e,q,u,a,t,dot"
          ),
        "Lorem ipsum long":
        K("L,o,r,e,m,space,i,p,s,u,m,space,d,o,l,o,r,space,s,i,t,space,a,m,e,t,comma,space,c,o,n,s,e,c,t,e,t,u,r,space,a,d,i,p,i,s,i,c,i,n,g,space,e,l,i,t,comma,space,s,e,d,space,d,o,space,e,i,u,s,m,o,d,space,t,e,m,p,o,r,space,i,n,c,i,d,i,d,u,n,t,space,u,t,space,l,a,b,o,r,e,space,e,t,space,d,o,l,o,r,e,space,m,a,g,n,a,space,a,l,i,q,u,a,dot,space,U,t,space,e,n,i,m,space,a,d,space,m,i,n,i,m,space,v,e,n,i,a,m,comma,space,q,u,i,s,space,n,o,s,t,r,u,d,space,e,x,e,r,c,i,t,a,t,i,o,n,space,u,l,l,a,m,c,o,space,l,a,b,o,r,i,s,space,n,i,s,i,space,u,t,space,a,l,i,q,u,i,p,space,e,x,space,e,a,space,c,o,m,m,o,d,o,space,c,o,n,s,e,q,u,a,t,dot,space,D,u,i,s,space,a,u,t,e,space,i,r,u,r,e,space,d,o,l,o,r,space,i,n,space,r,e,p,r,e,h,e,n,d,e,r,i,t,space,i,n,space,v,o,l,u,p,t,a,t,e,space,v,e,l,i,t,space,e,s,s,e,space,c,i,l,l,u,m,space,d,o,l,o,r,e,space,e,u,space,f,u,g,i,a,t,space,n,u,l,l,a,space,p,a,r,i,a,t,u,r,dot,space,E,x,c,e,p,t,e,u,r,space,s,i,n,t,space,o,c,c,a,e,c,a,t,space,c,u,p,i,d,a,t,a,t,space,n,o,n,space,p,r,o,i,d,e,n,t,comma,space,s,u,n,t,space,i,n,space,c,u,l,p,a,space,q,u,i,space,o,f,f,i,c,i,a,space,d,e,s,e,r,u,n,t,space,m,o,l,l,i,t,space,a,n,i,m,space,i,d,space,e,s,t,space,l,a,b,o,r,u,m,dot,L,o,r,e,m,space,i,p,s,u,m,space,d,o,l,o,r,space,s,i,t,space,a,m,e,t,comma,space,c,o,n,s,e,c,t,e,t,u,r,space,a,d,i,p,i,s,i,c,i,n,g,space,e,l,i,t,comma,space,s,e,d,space,d,o,space,e,i,u,s,m,o,d,space,t,e,m,p,o,r,space,i,n,c,i,d,i,d,u,n,t,space,u,t,space,l,a,b,o,r,e,space,e,t,space,d,o,l,o,r,e,space,m,a,g,n,a,space,a,l,i,q,u,a,dot,space,U,t,space,e,n,i,m,space,a,d,space,m,i,n,i,m,space,v,e,n,i,a,m,comma,space,q,u,i,s,space,n,o,s,t,r,u,d,space,e,x,e,r,c,i,t,a,t,i,o,n,space,u,l,l,a,m,c,o,space,l,a,b,o,r,i,s,space,n,i,s,i,space,u,t,space,a,l,i,q,u,i,p,space,e,x,space,e,a,space,c,o,m,m,o,d,o,space,c,o,n,s,e,q,u,a,t,dot,space,D,u,i,s,space,a,u,t,e,space,i,r,u,r,e,space,d,o,l,o,r,space,i,n,space,r,e,p,r,e,h,e,n,d,e,r,i,t,space,i,n,space,v,o,l,u,p,t,a,t,e,space,v,e,l,i,t,space,e,s,s,e,space,c,i,l,l,u,m,space,d,o,l,o,r,e,space,e,u,space,f,u,g,i,a,t,space,n,u,l,l,a,space,p,a,r,i,a,t,u,r,dot,space,E,x,c,e,p,t,e,u,r,space,s,i,n,t,space,o,c,c,a,e,c,a,t,space,c,u,p,i,d,a,t,a,t,space,n,o,n,space,p,r,o,i,d,e,n,t,comma,space,s,u,n,t,space,i,n,space,c,u,l,p,a,space,q,u,i,space,o,f,f,i,c,i,a,space,d,e,s,e,r,u,n,t,space,m,o,l,l,i,t,space,a,n,i,m,space,i,d,space,e,s,t,space,l,a,b,o,r,u,m,dot"
          )
    }
Ejemplo n.º 5
0
class ThunderbirdCoreRule(MappingRule):
    mapping = {
        "command": K("colon")
        # pages
        ,
        "open": K("t"),
        "open same": K("o"),
        "help": Firefox("helpall"),
        "reload": K("r"),
        "reload uncached": K("R")
    }
    defaults = {"text": ""}
    extras = [chc_base.text]
Ejemplo n.º 6
0
class EshellRule(MappingRule):
    mapping = {
        "kill eshell": T("(let ((inhibit-read-only t)) (kill-this-buffer))\n"),
        "chai (op | open)": T("find-file "),
        "chai (op | open) <text>": T("find-file %(text)s") + K("tab,enter"),
        "chai (win | windows)": T("op "),
        "chai (win | windows) <text>": T("op %(text)s") + K("tab,enter"),
        "chai (ex | explorer)": T("ex "),
        "chai (ex | explorer) <text>": T("ex %(text)s") + K("tab,enter"),
        "chai (ex | explorer) (here | this)": T("ex .\n")
    }
    defaults = {"text": ""}
    extras = [chc_base.text, chc_base._1to10]
Ejemplo n.º 7
0
def tags(element):
    elementString = str(element)
    if element in voidElements:
        T("<%s />" % str(element)).execute()
    else:
        T("<%s></%s>" % (elementString, elementString)).execute()
        K("left:%s" % (len(elementString) + 3)).execute()
Ejemplo n.º 8
0
class EmacsShortcutRule(MappingRule):
    mapping = {
        "quit [<1to100>]": K("c-g:%(1to100)d"),
        "(cop | copy)": Emacs("clipboard-kill-ring-save"),
        "cut": Emacs("clipboard-kill-region"),
        "paste": Emacs("clipboard-yank")
    }
    defaults = {"1to100": 1}
    extras = [chc_base._1to100]
Ejemplo n.º 9
0
class WindowsRule(MappingRule):
    mapping = {
        #, "closapp": K("win:down, a-f4, win:up") # switch
        #, "closapp": K("alt:down, f4, alt:up")
        #, "closapp": K("a-f4")
        "closapp":
        Function(lambda: natlink.recognitionMimic(["close", "window"]))
        #, "swatch": K("alt:down") + P("20") + K("tab") + P("20") + K("alt:up") # switch app
        #, "swatch": K("win:down, a-tab, win:up") # switch tab
        ,
        "swatch":
        StartApp("explorer.exe", chc_base.dir_bin + "window-switch.lnk"),
        "swatcha":
        StartApp("explorer.exe", chc_base.dir_bin + "window-switch.lnk") +
        K("enter"),
        "swap":
        K("c-tab")  # switch tab
        ,
        "putty <host_name>":
        DynStartApp(chc_base.exe_putty, "-load", "%(host_name)s"),
        "sound settings":
        WinCmd("C:\Windows\System32\mmsys.cpl")
    }
    extras = [chc_base.host_name]
Ejemplo n.º 10
0
class VimShortcutRule(MappingRule):
    mapping = {
        # general
        "quit [<1to100>]": K("escape:%(1to100)d"),
        "(cop | copy) [<1to100>]": K("y:%(1to100)d"),
        "cut [<1to100>]": K("d:%(1to100)d"),
        "paste [<1to100>]": K("p:%(1to100)d"),
        "(undo | scratch) [<1to100>]": K("escape, u:%(1to100)d"),
        "redo [<1to100>]": K("escape, c-r:%(1to100)d"),
        "find [<1to100>]": K("slash:%(1to100)d"),
        "find now <text>": K("slash") + T('%(text)s'),
        "close": K("escape, colon, q, enter")
        # files
        ,
        "(nuphyle | new file)": Vim("n"),
        "(ophyle |  open file)": Vim("e"),
        "(saphyle | save file)": Vim("w"),
        "(saphylas | save file as)": Vim("saveas")
    }
    defaults = {"text": "", "1to100": 1}
    extras = [chc_base.text, chc_base._1to100]
Ejemplo n.º 11
0
class MetaKeysRule(MappingRule):
    mapping = {
        "<metakey> <letter_or_digit>": K("%(metakey)s-%(letter_or_digit)s"),
        "<metakey> <direction>": K("%(metakey)s-%(direction)s"),
        "winmove <direction> [<1to10>]": K("sw-%(direction)s:%(1to10)d"),
        "shift tab": K("s-tab"),
        "(metapoint | metadot)": K("a-dot"),
        "metaquote": K("a-quote"),
        "(alt slash | aslash)": K("a-slash"),
        "context": K("apps")
    }
    defaults = {"1to10": 1, "text": ""}
    extras = [
        chc_base.text,
        chc_base._1to10,
        chc_base.letter_or_digit,
        chc_base.direction,
        chc_base.metakey,
    ]
Ejemplo n.º 12
0
class VimNavigatingKeysRule(MappingRule):
    mapping = {
        # Words
        "foo [<1to100>]":
        K("w:%(1to100)d"),
        "sell foo [<1to100>]":
        K("v, w:%(1to100)d"),
        "dee foo [<1to100>]":
        K("v, w:%(1to100)d, d"),
        "bar [<1to100>]":
        K("b:%(1to100)d"),
        "sell bar [<1to100>]":
        K("v, b:%(1to100)d"),
        "dee bar [<1to100>]":
        K("v, b:%(1to100)d, d"),
        "sellword [<1to100>]":
        K("v") + K("sc-right:%(1to100)d")
        # Lines
        ,
        "sellome":
        K("v, home"),
        "deelome":
        K("v, home, d"),
        "sellend":
        K("v, end"),
        "deelend":
        K("v, end, d"),
        "cleeline":
        K("escape"),
        "selline [<0to100>]":
        K("home, v,down:%(0to100)d, end"),
        "deeline [<0to100>]":
        K("home, v,down:%(0to100)d, end, d"),
        "coline [<0to100>]":
        K("home, v,down:%(0to100)d, end, y"),
        "dupline  [<0to100>] [<1to10>]":
        K("home, v,down:%(0to100)d, end, y") + P("20") +
        K("enter, p:%(1to10)d")
        # Pages
        ,
        "go to home":
        K("g:2"),
        "go to end":
        K("G"),
        "sell-all":
        K("g:2,V,G")
    }
    defaults = {"0to100": 0, "1to10": 1, "1to100": 1}
    extras = [chc_base._0to100, chc_base._1to10, chc_base._1to100]
Ejemplo n.º 13
0
class CssCoreRule(MappingRule):
    mapping = {
        # general
        "[<n>] <css_length>":
        T("%(n)s%(css_length)s")
        # selectors
        ,
        "idea [<text>]":
        T("#%(text)s "),
        "class [<text>]":
        T(".%(text)s")
        # attributes
        ,
        "background":
        T("background: ;") + K("left"),
        "background <css_color>":
        T("background: %(color)s;"),
        "background <css_color> <css_image>":
        T("background: %(css_color)s %(css_image)s;") + K("left:3"),
        "background <css_color> <css_image> <css_repeat>":
        T("background: %(css_color)s %(css_image)s %(css_repeat)s;") +
        K("left:3"),
        "background <css_color> <css_image> <css_repeat> <css_attachment>":
        T("background: %(css_color)s %(css_image)s %(css_repeat)s %(css_attachment)s;"
          ) + K("left:3"),
        "background <css_color> <css_image> <css_repeat> <css_attachment> <css_position>":
        T("background: %(css_color)s %(css_image)s %(css_repeat)s %(css_attachment)s %(css_position)s;"
          ) + K("left:3"),
        "background color <css_color>":
        T("background-color: %(css_color)s;"),
        "background position <css_position>":
        T("background-position: %(css_position)s;"),
        "background repeat <css_repeat>":
        T("background-repeat: %(css_repeat)s;"),
        "background attachment <css_attachment>":
        T("background-attachment: %(css_attachment)s;"),
        "background image <css_image>":
        T("background-image: %(css_image)s;") + K("left:3"),
        "border [<css_direction_suffix>]":
        T("border%(css_direction_suffix)s: ;") + K("left"),
        "border [<css_direction_suffix>] <n> <css_length> <css_border> <css_color>":
        T("border%(css_direction_suffix)s: %(n)s%(css_length)s %(css_border)s %(css_color)s;"
          ),
        "border [<css_direction_suffix>] with <n> <css_length>":
        T("border%(css_direction_suffix)s: %(n)s%(css_length)s;"),
        "border [<css_direction_suffix>] style <css_border>":
        T("border%(css_direction_suffix)s-style: %(css_border)s;"),
        "border [<css_direction_suffix>] color <css_color>":
        T("border%(css_direction_suffix)s-color: %(css_color)s;"),
        "<css_direction> [<n>] <css_length>":
        T("%(css_direction)s: %(n)s%(css_length)s;"),
        "caption-side <css_caption_position>":
        T("caption-side: %(css_caption_position)s;"),
        "clear <css_clear>":
        T("clear: %(css_clear)s;"),
        "clip":
        T("clip: rect();") + K("left:2"),
        "color":
        T("color: #;") + K("left"),
        "color <css_color>":
        T("color: %(css_color)s;"),
        "color RGB":
        T("color: rgb();") + K("left:2"),
        "color RGB <n> <m> <o>":
        T("color: rgb(%(n)s,%(m)s,%(o)s;") + K("left"),
        "column count <n>":
        T("column-count: %(n)s;"),
        "cursor":
        T("cursor: ;") + K("left"),
        "text direction <css_text_direction>":
        T("direction: %(css_text_direction)s;"),
        "display <css_display>":
        T("display: %(css_display)s;"),
        "empty cells <css_cell_visibility>":
        T("empty-cells: %(css_cell_visibility)s;"),
        "float <css_float>":
        T("float: %(css_float)s;"),
        "font-family <css_font_family>":
        "font-family: %(css_font_family)s;",
        "font size":
        T("font-size: ;") + K("left"),
        "font size [<n>] <css_length>":
        T("font-size: %(n)s%(css_length)s;"),
        "font style <css_font_style>":
        T("font-style: %(css_font_style)s;"),
        "font weight <css_font_weight>":
        T("font-weight: %(css_font_weight)s;"),
        "font variant <css_font_variant>":
        T("font-variant: %(css_font_variant)s;"),
        "font":
        T("font: ;") + K("left"),
        "font <n> <css_length> <css_font_family>":
        T("font: %(n)s%(css_length)s %(css_font_family)s;"),
        "font <n> <css_length_a> <m> <css_length_b> <css_font_family>":
        T("font: %(n)s%(css_length_a)s/%(m)s%(css_length_b)s %(css_font_family)s;"
          ),
        "<css_font_family>":
        T("%(css_font_family)s"),
        "height":
        T("height: ;") + K("left"),
        "height [<n>] <css_length>":
        T("height: %(n)s%(css_length)s;"),
        "letter spacing <n> <css_length>":
        T("letter-spacing: %(n)s%(css_length)s;"),
        "list style image none":
        T("list-style-image: none;"),
        "list style image <css_image>":
        T("list-style-image: %(css_image)s;") + K("left:3"),
        "list style position <css_list_position>":
        T("list-style-position: %(css_list_position)s;"),
        "list style type <css_list_type>":
        T("lists-style-type: %(css_list_type)s;"),
        "list style <css_list_type> <css_list_position> <css_image>":
        T("list-style: %(css_list_type)s %(css_list_position)s %(css_image)s;")
        + K("left:3"),
        "list style <css_list_position> <css_image>":
        T("list-style: %(css_list_position)s %(css_image)s;") + K("left:3"),
        "list style <css_list_type> <css_list_position>":
        T("list-style: %(css_list_type)s %(css_list_position)s;"),
        "margin [<css_direction_suffix>]":
        T("margin%(css_direction_suffix)s: ;") + K("left"),
        "margin [<css_direction_suffix>] [<n>] <css_length>":
        T("margin%(css_direction_suffix)s: %(n)s%(css_length)s;"),
        "max height":
        T("max-height: ;") + K("left"),
        "max height [<n>] <css_length>":
        T("max-height: %(n)s%(css_length)s;"),
        "max with":
        T("max-width: ;") + K("left"),
        "max with [<n>] <css_length>":
        T("max-width: %(n)s%(css_length)s;"),
        "min height":
        T("min-height: ;") + K("left"),
        "min height [<n>] <css_length>":
        T("min-height: %(n)s%(css_length)s;"),
        "min with":
        T("min-width: ;") + K("left"),
        "min with [<n>] <css_length>":
        T("min-width: %(n)s%(css_length)s;")
        # TODO: Integrate the CSS media queries.
        ,
        "opacity <n>":
        T("opacity: %(n)s;"),
        "opacity <n> point <m>":
        T("opacity: %(n)s.%(m)s;"),
        "outline":
        T("outline: ;") + K("left"),
        "outline <css_color> <css_border> <n> <css_length>":
        T("outline: %(css_color)s %(css_border)s %(n)s%(css_length)s;"),
        "outline with <n> <css_length>":
        T("outline: %(n)s%(css_length)s;"),
        "outline style <css_border>":
        T("outline-style: %(css_border)s;"),
        "outline color <css_color>":
        T("outline-color: %(css_color)s;"),
        "padding [<css_direction_suffix>]":
        T("padding%(css_direction_suffix)s: ;") + K("left"),
        "padding [<css_direction_suffix>] [<n>] <css_length>":
        T("padding%(css_direction_suffix)s: %(n)s%(css_length)s;"),
        "page break <css_page_break_position>":
        T("page-break-%(css_page_break_position)s: ;") + K("left"),
        "page break <css_page_break_position> <css_page_break>":
        T("page-break-%(css_page_break_position)s: %(css_page_break)s;"),
        "position":
        T("position: ;") + K("left"),
        "position <css_position>":
        T("position: %(css_position)s;"),
        "quotes":
        T("quotes: ;") + K("left"),
        "quotes <css_quote>":
        T("quotes: %(css_quote)s;"),
        "quotes <css_quote_a> <css_quote_b>":
        T("quotes: %(css_quote_a)s %(css_quote_b)s;"),
        "table layout":
        T("table-layout: ;") + K("left"),
        "table layout <css_table_layout>":
        T("table-layout: %(css_table_layout)s;"),
        "text align":
        T("text-align: ;") + K("left"),
        "text align <css_text_align>":
        T("text-align: %(css_text_align)s;"),
        "text decoration":
        T("text-decoration: ;") + K("left"),
        "text decoration <css_text_decoration>":
        T("text-decoration: %(css_text_decoration)s;"),
        "text indent":
        T("text-indent: ;") + K("left"),
        "text indent <n> <css_length>":
        T("text-indent: %(n)s%(css_length)s;"),
        "text transform":
        T("text-transform: ;") + K("left"),
        "text transform <css_text_transform>":
        T("text-transform: %(css_text_transform)s;"),
        "vertical align":
        T("vertical-align: ;") + K("left"),
        "vertical align <n> <css_length>":
        T("vertical-align: %(n)s%(css_length)s;"),
        "vertical align <css_vertical_align>":
        T("vertical-align: %(css_vertical_align)s;"),
        "visibility":
        T("visibility: ;") + K("left"),
        "visibility <css_visibility>":
        T("visibility: %(css_visibility)s;"),
        "whitespace":
        T("white-space: ;") + K("left"),
        "whitespace <css_whitespace>":
        T("white-space: %(css_whitespace)s;"),
        "width":
        T("width: ;") + K("left"),
        "width [<n>] <css_length>":
        T("width: %(n)s%(css_length)s;"),
        "word spacing":
        T("word-spacing: ;") + K("left"),
        "word spacing <n> <css_length>":
        T("word-spacing: %(n)s%(css_length)s;"),
        "word wrap":
        T("word-wrap: ;") + K("left"),
        "word wrap <css_word_wrap>":
        T("word-wrap: %(css_word_wrap);"),
        "Z index":
        T("z-index: ;") + K("left"),
        "Z index [<css_minus>] <n>":
        T("z-index: %(css_minus)s%(n)s;")
    }
    defaults = {
        "text": "",
        "n": "",
        "m": "",
        "o": "",
        "css_direction_suffix": "",
        "css_color": "transparent",
        "css_image": "default",
        "css_minus": ""
    }
    extras = [
        chc_base.text, chc_base.any_number_n, chc_base.any_number_m,
        chc_base.any_number_o, chc_web.css_border, chc_web.css_length,
        chc_web.css_length_a, chc_web.css_length_b,
        chc_web.css_direction_suffix, chc_web.css_direction, chc_web.css_color,
        chc_web.css_image, chc_web.css_repeat, chc_web.css_attachment,
        chc_web.css_position, chc_web.css_caption_position, chc_web.css_clear,
        chc_web.css_display, chc_web.css_text_direction,
        chc_web.css_cell_visibility, chc_web.css_float,
        chc_web.css_font_family, chc_web.css_font_style,
        chc_web.css_font_weight, chc_web.css_font_variant,
        chc_web.css_list_position, chc_web.css_list_type,
        chc_web.css_page_break, chc_web.css_page_break_position,
        chc_web.css_quote, chc_web.css_quote_a, chc_web.css_quote_b,
        chc_web.css_table_layout, chc_web.css_text_align,
        chc_web.css_text_decoration, chc_web.css_text_transform,
        chc_web.css_vertical_align, chc_web.css_visibility,
        chc_web.css_whitespace, chc_web.css_word_wrap, chc_web.css_minus
    ]
Ejemplo n.º 14
0
class ShortcutRule(MappingRule):
    mapping = {
        # general
        "quit [<1to100>]": K("escape:%(1to100)d"),
        "(cop | copy) [<1to100>]": K("c-c:%(1to100)d"),
        "cut [<1to100>]": K("c-x:%(1to100)d"),
        "paste [<1to100>]": K("c-v:%(1to100)d"),
        "(undo | scratch) [<1to100>]": K("c-z:%(1to100)d"),
        "redo [<1to100>]": K("c-y:%(1to100)d"),
        "find [<1to100>]": K("c-f:%(1to100)d"),
        "find now <text>": K("c-f") + T('%(text)s'),
        "close": K("c-w")
        # files
        ,
        "(nuphyle | new file)": K("c-n"),
        "(ophyle |  open file)": K("c-o"),
        "(saphyle | save file)": K("c-s"),
        "(saphylas | save file as)": K("cs-s")
    }
    defaults = {"1to100": 1, "text": ""}
    extras = [chc_base.text, chc_base._1to100]
Ejemplo n.º 15
0
class GitRule(MappingRule):
    mapping = {
        "git ":
        T("git "),
        "git add":
        T("git add "),
        "git add all":
        T("git add -A :/"),
        "git add all dir[ectory]":
        T("git add -A ."),
        "git add <text>":
        T("git add %(text)s") + K("tab:3"),
        "git initial commit":
        T('git commit -m "Initial commit.\n"'),
        "git commit":
        T('git commit -m ""') + K("left"),
        "git commit all":
        T('git commit -am ""') + K("left"),
        'git amend':
        T("git commit --amend --no-edit\n"),
        'git amend message':
        T("git commit --amend\n"),
        "git init":
        T("git init\n"),
        "git remote [show]":
        T("git remote -v\n"),
        "git remote add":
        T("git remote add "),
        "git remote add <text>":
        T("git remote add %(text)s "),
        "git remote add <text> partenza":
        T("git remote add %(text)s [email protected]:"),
        "git remote add origin":
        T("git remote add origin [email protected]:"),
        "git remote remove":
        T("git remote remove "),
        "git push":
        T("git push\n"),
        "git push force":
        T("git push --force\n"),
        "git push upstream":
        T("git push -u "),
        "git push origin master":
        T("git push -u origin master\n"),
        "git pull":
        T("git pull\n"),
        "git status":
        T("git status\n"),
        "git reset":
        T("git reset "),
        "git reset <text>":
        T("git reset %(text)s") + K("tab:3"),
        "git reset head":
        T("git reset HEAD "),
        "git reset head <text>":
        T("git reset HEAD %(text)s") + K("tab:3"),
        "git reset hard":
        T("git reset --hard "),
        "git reset hard origin":
        T("git reset --hard origin/master"),
        "git reset hard head":
        T("git reset --hard HEAD"),
        "git branch":
        T("git branch "),
        "git branch <text>":
        T("git branch %(text)s "),
        "git branch move":
        T("git branch -m "),
        "git branch delete":
        T("git branch -D "),
        "git branch delete <text>":
        T("git branch -D %(text)s "),
        "git branches":
        T("git branch -l\n"),
        "git clone":
        T("git clone "),
        "git checkout":
        T("git checkout "),
        "git checkout <text>":
        T("git checkout %(text)s\n"),
        "git checkout branch":
        T("git checkout -b "),
        "git checkout branch <text>":
        T("git checkout -b %(text)s\n"),
        "git diff":
        T("git diff "),
        "git diff head":
        T("git diff HEAD\n"),
        "git diff master":
        T("git diff master.."),
        "git diff <text>":
        T("git diff %(text)s "),
        "git fetch":
        T("git fetch "),
        "git fetch <text>":
        T("git fetch %(text)s "),
        "git fetch origin":
        T("git fetch origin\n"),
        "git fetch upstream":
        T("git fetch upstream\n"),
        "git log":
        T("git log --stat \n"),
        "git log <1to100>":
        T("git log --stat -%(1to100)s\n"),
        "git log changes":
        T("git log -p \n"),
        "git log changes <1to100>":
        T("git log -p -%(1to100)s\n"),
        "git merge":
        T("git merge "),
        "git merge <text>":
        T("git merge %(text)s"),
        "git cherry pick":
        T("git cherry-pick "),
        "git cherry pick abort":
        T("git cherry-pick --abort\n"),
        "git cherry pick continue":
        T("git cherry-pick --continue\n"),
        "git tag":
        T("git tag\n"),
        "git tag list":
        T("git tag -l ''") + K("left"),
        "git tag list <text>":
        T("git tag -l '%(text)s'") + K("left"),
        "git tag create":
        T("git tag -a v0.0 -m \"\"") + K("left"),
        "git tag create <text>":
        T("git tag -a vx -m \"%(text)s\"") + K("left"),
        "git tag delete":
        T("git tag -d"),
        "git tag push":
        T("git push --tags\n"),
        "git push tag[s]":
        T("git push --tags\n"),
        "git show":
        T("git show "),
        "git show <text>":
        T("git show %(text)s ")
    }
    defaults = {"text": "", "1to100": "1"}
    extras = [chc_base.text, chc_base._1to100]
Ejemplo n.º 16
0
class FirefoxCoreRule(MappingRule):
    mapping = {
        "command":
        K("escape") + K("colon")
        # pages
        ,
        "open":
        K("escape") + K("t"),
        "open <text>":
        K("escape") + Firefox("open %(text)s", False) + P("20") + K("tab/20"),
        "tropen <text>":
        K("escape") + Firefox("open %(text)s", False) + P("20") + K("tab/20"),
        "tab open":
        K("escape") + K("o"),
        "tab open <text>":
        K("escape") + Firefox("tabopen %(text)s", False) + P("20") +
        K("tab/20, enter"),
        "tab tropen <text>":
        K("escape") + Firefox("tabopen %(text)s", False) + P("20") +
        K("tab/20"),
        "help":
        K("escape") + Firefox("helpall"),
        "reload":
        K("escape") + K("r"),
        "reload uncached":
        K("escape") + K("R")
        # tabs
        ,
        "(nexta | righta)":
        K("escape") + K("g,t"),
        "(preeta | lefta)":
        K("escape") + K("g,T"),
        "feeta":
        K("escape") + K("g,0"),
        "latta":
        K("escape") + K("g,dollar"),
        "clotta":
        K("escape") + K("d")
        # special pages
        ,
        "home pah":
        K("escape") + K("g,H"),
        "home page":
        K("escape") + K("g,h"),
        "page same <website>":
        K("escape") + K("o") + T("%(website)s") + K("enter"),
        "page <website>":
        K("escape") + K("t") + T("%(website)s") + K("enter")
        # hint
        ,
        "hint":
        K("escape") + K("f")
        # bookmarks
        ,
        "book all":
        K("escape") + T(":bmarks") + K("enter")
        # find
        ,
        "next":
        K("escape") + K("n")
    }
    defaults = {"text": ""}
    extras = [chc_base.text, chc_base.website]
Ejemplo n.º 17
0
class ShellCoreRule(MappingRule):
    mapping = {
        "exit":
        T("exit\n"),
        "alias":
        T("alias "),
        "cat":
        T("cat "),
        "shell copy":
        T("cp "),
        "chai":
        T("cd "),
        "chai <text>":
        T("cd %(text)s") + K("tab,enter"),
        "chai chain <text>":
        T("cd %(text)s") + K("tab:3"),
        "chain <text>":
        T("%(text)s") + K("tab:3"),
        "chai up":
        T("cd ..\n"),
        "chaif <common_folder>":
        T("cd %(common_folder)s\n"),
        "differences":
        T("diff "),
        "disk usage":
        T("du -ch\n"),
        "disk usage all":
        T("du -ach\n"),
        "echo":
        T("echo "),
        "echo path":
        T("echo $PATH\n"),
        "environment":
        T("env\n"),
        "glimpse":
        T("glimpse "),
        "<grep>":
        T("%(grep)s -rin -B2 -A2 '' .") + K("left:3"),
        "<grep> <text>":
        T("%(grep)s -rin -B2 -A2 '%(text)s' .\n"),
        "info documentation":
        T("info "),
        "jobs":
        T("jobs -l\n"),
        "jobs running":
        T("jobs -lr\n"),
        "jobs stopped":
        T("jobs -ls\n"),
        "kill process":
        T("kill "),
        "kill process now":
        T("kill -9 "),
        "link soft":
        T("ln -s "),
        "link hard":
        T("ln "),
        "list":
        T("ls -la\n"),
        "list <text>":
        T("ls -la %(text)s") + K("tab,enter"),
        "list chain <text>":
        T("ls -la %(text)s") + K("tab:3"),
        "list up":
        T("ls -la ..\n"),
        "list up up":
        T("ls -la ../..\n"),
        "locate":
        T("locate "),
        "locate update":
        T("updatedb\n"),
        "man page":
        T("man "),
        "chai chai":
        T("mkdir "),
        "chai chai <text>":
        T("mkdir %(text)s\n"),
        "chai chai parent":
        T("mkdir -p "),
        "chai chai parent <text>":
        T("mkdir -p %(text)s\n"),
        "move":
        T("mv "),
        "move <text> to [<text2>]":
        T("mv %(text)s") + K("tab") + T(" %(text2)s") + K("tab"),
        "push (directory | chai)":
        T("pushd .\n"),
        "push other (directory | chai)":
        T("pushd "),
        "pop (directory | chai)":
        T("popd\n"),
        "(directory | chai) stack":
        T("dirs\n"),
        "print (working directory | chai)":
        T("pwd\n"),
        "remove":
        T("rm "),
        "remove (directory | chai)":
        T("rmdir "),
        "remove (directory | chai) recursively":
        T("rmdir -r"),
        "run":
        T("./"),
        "run <text>":
        T("./%(text)s") + K("tab,enter"),
        "(sudo | super [user] do)":
        T("sudo "),
        "switch user":
        T("su "),
        "switch user <os_user>":
        T("su %(os_user)s\n"),
        "time":
        T("time "),
        "user mask":
        T("umask "),
        "who am I":
        T("whoami\n"),
        "help flag":
        T(" --help"),
        "help flag short":
        T(" -h"),
        "verbose flag":
        T(" --verbose"),
        "verbose flag short":
        T(" -v"),
        "run updates":
        T("runupdates \n"),
        "force updates":
        T("runupdates -f\n"),
        "check updates":
        T("checkupdates\n"),
        "restart":
        T("sudo shutdown -r now\n"),
        "reboot":
        T("sudo reboot\n"),
        "shutdown":
        T("sudo shutdown now\n"),
        "shaste":
        M("(0.5, 0.5), right")
        # tools
        ,
        "apt[itude] search":
        T("sudo aptitude search "),
        "apt[itude] install":
        T("sudo aptitude install "),
        "apt[itude] show":
        T("sudo aptitude show "),
        "apt[itude] update":
        T("sudo aptitude update\n"),
        "apt[itude] upgrade":
        T("sudo aptitude update && aptitude upgrade\n"),
        "gem[s] chek":
        T("gem outdated\n"),
        "gem[s] update":
        T("gem update\n"),
        "MD 5 check":
        T("md5sum -c "),
        "root kit Hunter check":
        T("rkhunter --check\n"),
        "root kit Hunter update":
        T("rkhunter --propupd\n"),
        "check root kit":
        T("chkrootkit\n"),
        "web get":
        T("wget "),
        "vim":
        T("vi "),
        "vim <text>":
        T("vi %(text)s") + K("tab,enter"),
        "vimf <common_file>":
        T("vi %(common_file)s\n"),
        "vimslap":
        T("vi\n"),
        "suvim":
        T("sudo vi "),
        "suvim <text>":
        T("sudo vi %(text)s") + K("tab,enter"),
        "suvimf <common_file>":
        T("sudo vi %(common_file)s\n"),
        "suvimslap":
        T("sudo vi\n"),
        "emacs":
        T("emacs "),
        "emacs <text>":
        T("emacs %(text)s") + K("tab,enter"),
        "emaff <common_file>":
        T("emacs %(common_file)s\n"),
        "emacslap":
        T("emacs\n"),
        "sumacs":
        T("sudo emacs "),
        "sumacs <text>":
        T("sudo emacs %(text)s") + K("tab,enter"),
        "sumaff <common_file>":
        T("sudo emacs %(common_file)s\n"),
        "sumacslap":
        T("sudo emacs\n")
    }
    defaults = {"text": "", "text2": ""}
    extras = [
        chc_base.text, chc_base.text2, chc_base.common_file,
        chc_base.common_folder, chc_base.grep, chc_base.os_user
    ]
Ejemplo n.º 18
0
class StandardKeysRule(MappingRule):
    mapping = {
        "(space | ace ) [<1to100>]": K("space"),
        "slap [<1to100>]": K("enter:%(1to100)d"),
        "(tap | tab) [<1to100>]": K("tab:%(1to100)d"),
        "escape [<1to100>]": K("escape:%(1to100)d"),
        "backspace [<1to100>]": K("backspace:%(1to100)d"),
        "delete [<1to100>]": K("delete:%(1to100)d")
        # punctuation
        ,
        "(dot | period) [<1to100>]": K("dot:%(1to100)d"),
        "(comma | cam)": K("comma"),
        "(colon|coal) [<1to100>]": K("colon:%(1to100)d"),
        "(semi colon|sem-col|sem-coal)": T(";"),
        "(exclaim|clam)": K("exclamation"),
        "(question-mark|quest)": K("question"),
        "slash": K("slash"),
        "backslash": K("backslash"),
        "sing": K("apostrophe"),
        "quote": K("dquote"),
        "(hyphen|hive)": K("hyphen")
        # operator
        ,
        "(under | ska)": K("underscore"),
        "plus [<1to100>]": K("plus:%(1to100)d"),
        "minus [<1to100>]": K("minus:%(1to100)d"),
        "equal[s] [<1to100>]": K("equal:%(1to100)d"),
        "percent": K("percent"),
        "dollar": K("dollar"),
        "(star | asterix | asterisk)": K("asterisk"),
        "hash [<1to100>]": K("hash:%(1to100)d"),
        "tilde": K("tilde"),
        "lat": T("@"),
        "(ampersand | amper)": K("ampersand"),
        "pipe": K("bar")
        # parenthesis
        ,
        "laip": K("lparen"),
        "rape": K("rparen"),
        "lack": K("lbracket"),
        "rack": K("rbracket"),
        "lace": K("lbrace"),
        "race": K("rbrace"),
        "lang": T("<"),
        "rang": T(">")
        # operator combo
        ,
        "greater than": T(" > "),
        "less than": T(" < "),
        "g-equal": T(" >= "),
        "l-equal": T(" <= "),
        "(triple arrow | tri-lang)": T(" <<< "),
        "minus-equal": T(" -= "),
        "plus-equal": T(" += "),
        "star-equal": T(" *= "),
        "minus-minus": T("--"),
        "plus-plus": T("++"),
        "double-equal": T(" == "),
        "(not-equal | nequal)": T(" != "),
        "logical-and": T(" && "),
        "logical-or": T(" || "),
        "left-shift": T(" << "),
        "right-shift": T(" >> ")
        # space combo
        ,
        "spive": T(" -"),
        "pive": T("- "),
        "pivak": T("- [ ]"),
        "scol": T(": "),
        "spipe": T(" | "),
        "splus": T(" + "),
        "spequal": T(" = "),
        "scam": T(", "),
        "shash": T("# "),
        "lote": K("lparen,quote")
        # function keys
        ,
        "F1 [key]": K("f1"),
        "F2 [key]": K("f2"),
        "F3 [key]": K("f3"),
        "F4 [key]": K("f4"),
        "F5 [key]": K("f5"),
        "F6 [key]": K("f6"),
        "F7 [key]": K("f7"),
        "F8 [key]": K("f8"),
        "F9 [key]": K("f9"),
        "F10 [key]": K("f10"),
        "F11 [key]": K("f11"),
        "F12 [key]": K("f12")
    }
    defaults = {"1to100": 1}
    extras = [chc_base._1to100]
Ejemplo n.º 19
0
class EmacsCoreRule(MappingRule):
    mapping = {
        "command":
        K("a-u"),
        "elast":
        Emacs("eval-print-last-sexp"),
        "close emacs":
        Emacs("save-buffers-kill-terminal"),
        "(eshell | shell) [<1to10>]":
        K("c-%(1to10)s") + Emacs("eshell")
        ## bindings
        ,
        "describe function":
        Emacs("describe-function"),
        "describe key":
        Emacs("describe-key")
        ## chars
        ,
        "unicode":
        Emacs("insert-char"),
        "transpose-chars":
        Emacs("transpose-chars")
        ## words
        ,
        "transpose-words":
        Emacs("transpose-words"),
        "replace word [with] <text>":
        Emacs("kill-word") + T("%(text)s"),
        "replace last word [with] <text>":
        Emacs("backward-word") + Emacs("kill-word") + T("%(text)s"),
        "(downcase word | down-word)":
        Emacs("downcase-word"),
        "downcase last":
        Emacs("(downcase-word -1)"),
        "(upcase word | up-word)":
        Emacs("upcase-word"),
        "upcase last":
        Emacs("(upcase-word -1)"),
        "(capitalize | cap) word":
        Emacs("capitalize-word"),
        "cap last [word]":
        Emacs("(capitalize-word -1)"),
        "sub-word-mode":
        Emacs("subword-mode")
        ## lines
        ,
        "sort-lines":
        Emacs("sort-lines"),
        "(transpose-lines | trans-lines)":
        Emacs("transpose-lines"),
        "sort-columns":
        Emacs("sort-columns"),
        "flush-lines":
        Emacs("flush-lines"),
        "keep-lines":
        Emacs("keep-lines"),
        "align-regexp":
        Emacs("align-regexp"),
        "selline <0to10000> to <1to10000>":
        Emacs("goto-line") + T("%(0to10000)d\n") + K("home") +
        Emacs("set-mark-command") + Emacs("goto-line") + T("%(1to10000)d\n") +
        K("end")
        #        , "open-line [<1to10>]": Emacs("dss/-open-line-indent", narg='1to10')
        #        , "(o-line | jab)": Emacs("dss/smart-open-line")
        ,
        "count lines":
        Emacs("count-lines-region"),
        "count lines page":
        Emacs("count-lines-page")
        ## registers
        ,
        "ropy <letter_or_digit>":
        Emacs("copy-to-register") + T("%(letter_or_digit)s"),
        "repend <letter_or_digit>":
        Emacs("prepend-to-register") + T("%(letter_or_digit)s"),
        "rapend <letter_or_digit>":
        Emacs("append-to-register") + T("%(letter_or_digit)s"),
        "raste <letter_or_digit>":
        Emacs("insert-register") + T("%(letter_or_digit)s"),
        "roint <letter_or_digit>":
        Emacs("point-to-register") + T("%(letter_or_digit)s"),
        "reroint <letter_or_digit>":
        Emacs("register-to-point") + T("%(letter_or_digit)s"),
        "rump <letter_or_digit>":
        Emacs("jump-to-register") + T("%(letter_or_digit)s"),
        "rump":
        Emacs("jump-to-register"),
        "rist":
        Emacs("list-registers"),
        "rindow[s] <letter_or_digit>":
        Emacs("window-configuration-to-register") + T("%(letter_or_digit)s"),
        "rame[s] <letter_or_digit>":
        Emacs("frame-configuration-to-register") + K("%(letter_or_digit)s"),
        "ruffer":
        Emacs("undo-tree-save-state-to-register"),
        "reruffer":
        Emacs("undo-tree-restore-state-to-register")
        ## mark
        ,
        "[set] mark":
        Emacs("set-mark-command"),
        "sell up":
        Emacs("set-mark-command") + K("up"),
        "sell down":
        Emacs("set-mark-command") + K("down"),
        "point mark":
        Emacs("set-mark-command") + Emacs("set-mark-command"),
        "visible-marks":
        Emacs("visible-mark-mode"),
        "swap mark":
        Emacs("exchange-point-and-mark"),
        "jump mark":
        Emacs("pop-to-mark-command"),
        "glo[bal]-jark":
        Emacs("pop-global-mark")
        #, "(toggle mark | mark off | tark)": Emacs("k2-toggle-mark")
        #, sharks
        ,
        "highline mode":
        Emacs("hl-line-mode")
        ## operations on special markers
        #, "skack": Emacs("(dss/skeleton-next-position t)")
        #, "skext": Emacs("dss/skeleton-next-position")
        ## region
        ,
        "(capitalize|cap) [(region | it)]":
        Emacs("capitalize-region"),
        "downcase [(region | it)]":
        Emacs("downcase-region"),
        "upcase [(region | it)]":
        Emacs("upcase-region")
        #, "quote-(region | it)": Emacs("dss/quote-region")
        #, "stud-(region | it)": Emacs("dss/words-studley-region")
        #, "jive-stud-(region | it)": Emacs("dss/words-studley-to-sep-region")
        #, "single-quote-region": Emacs("dss/single-quote-region")
        #, "(eval | evaluate) region": Emacs("eval-region")
        ,
        "flash-region":
        Emacs("dss/flash-region"),
        "indent-region":
        Emacs("indent-region"),
        "narrow-to-region":
        Emacs("narrow-to-region"),
        "widen-to-buffer":
        Emacs("widen-to-buffer")
        #  the following two commands assume that the region has the
        #  point at the top and the mark at the bottom
        #, "shrink-region [<1to10>]": K(
        #    "right:%(1to10)d,c-x,c-x,left:%(1to10)d,c-x,c-x")
        #, "shrink-region by <1to10> line[s]": K(
        #    "down:%(1to10)d,c-x,c-x,up:%(1to10)d,c-x,c-x")
        ## kill ring
        ,
        "kill-ring":
        Emacs("browse-kill-ring")
        # goto
        ,
        "goost":
        Emacs("goto-last-change"),
        "em-goost":
        Emacs("goto-last-change-with-auto-marks"),
        "line <1to10000>":
        Emacs("goto-line") + T("%(1to10000)d\n") + Emacs("back-to-indentation")
        ## movement
        ,
        "snap":
        Emacs("back-to-indentation"),
        "de-snap":
        K("down") + Emacs("back-to-indentation"),
        "u-snap":
        K("up") + Emacs("back-to-indentation")
        #, "snap <0to1000>": (
        #    Emacs("dss/local-line-jump")
        #    + T("%(0to1000)s\n"))
        #, "(eol | yall | y'all) <0to1000>": (
        #    Emacs("dss/local-line-jump") +
        #    T("%(0to1000)s\n")
        #    + K("c-e"))
        #, "hub": Emacs("cdb/hup")
        #, "hown": Emacs("cdb/hown")
        #, "fup": Emacs("cdb/fup")
        #, "fown": Emacs("cdb/fown")
        #, "tup": Emacs("cdb/tup")
        #, "town": Emacs("cdb/town")
        ## textionary
        ,
        "reload textionary":
        Emacs("ac-clear-textionary-cache")
        ## buffers
        ,
        "ophyle":
        Emacs("ido-find-file")  # + Emacs("ido-find-file")
        ,
        "ophyle-here":
        Emacs("ido-find-file"),
        "ophyle <common_file>":
        Emacs("ido-find-file") + T("%(common_file)s") + K("enter"),
        "ophyle <text>":
        Emacs("ido-find-file") + T("%(text)s") + K("tab,enter"),
        "rifle":
        Emacs("recentf-open-files"),
        "(close (buff | buffer | window | file) | clyle)":
        Emacs("ergoemacs-close-current-buffer"),
        "pre-buff":
        Emacs("previous-buffer"),
        "next-buff":
        Emacs("next-buffer"),
        "bury-buff":
        Emacs("bury-buffer"),
        "unbury-buff":
        Emacs("unbury-buffer"),
        "I-buff":
        Emacs("ibuffer"),
        "e-buff":
        Emacs("eval-buffer"),
        "(swuff-scratch | swug-scratch)":
        K("c-x") + P("20") + K("b") + T("scratch\n"),
        "(swuff) [<text>]":
        K("c-x") + P("20") + K("b") + T("%(text)s"),
        "swug <text>":
        K("c-x") + P("20") + K("b") + T("%(text)s") + K("tab,enter"),
        "revert-buffer":
        Emacs("revert-buffer"),
        "diff-buffer":
        Emacs("diff-buffer-with-file")
        ## workgroups
        ,
        "create workgroup":
        Emacs("wg-create-workgroup"),
        "rename workgroup":
        Emacs("wg-rename-workgroup"),
        "switch workgroup":
        Emacs("wg-switch-to-workgroup"),
        "clone workgroup":
        Emacs("wg-clone-workgroup"),
        "revert workgroup":
        Emacs("wg-revert-workgroup"),
        "update workgroup":
        Emacs("wg-update-workgroup"),
        "update workgroup":
        Emacs("wg-update-workgroup"),
        "save workgroup":
        Emacs("wg-save"),
        "load workgroup":
        Emacs("wg-load"),
        "workgroup help":
        Emacs("wg-help")
        ## comments
        ,
        "comment":
        Emacs("comment-dwim"),
        "comment region":
        Emacs("comment-region"),
        "kill comment":
        Emacs("comment-kill"),
        "comment set column":
        Emacs("comment-set-column")
        ## panes
        ,
        "next-pane":
        Emacs("ergoemacs-move-cursor-next-pane")
        #        , "next-pane": K("a-i")
        ,
        "close-pane":
        Emacs("delete-window"),
        "close-other-pane":
        Emacs("delete-other-window"),
        "split-pane":
        Emacs("split-window-right"),
        "split-pane-horizontally":
        Emacs("split-window-below")
        ## auto completion
        ,
        "complete":
        Emacs("auto-complete")
        ## packages
        ,
        "package list":
        Emacs("package-list-packages"),
        "package initialize":
        Emacs("package-initialize"),
        "package install [<text>]":
        Emacs("package-install") + T("%(text)s"),
        "package install file [<text>]":
        Emacs("package-install-file") + T("%(text)s")
        ## directories

        # macros
        ,
        "start macro":
        Emacs("start-kbd-macro")

        #, "stop macro": Emacs("end-kbd-macro")
        # Running the text command interferes with the apply macro function. A pause is also required for the keystroke to be recognized correctly.
        ,
        "stop macro":
        K("c-x") + P("200") + T(")"),
        "run macro":
        Emacs("call-last-kbd-macro"),
        "apply macro":
        Emacs("apply-macro-to-region-lines"),
        "name macro":
        Emacs("name-last-kbd-macro"),
        "save macro":
        Emacs("insert-kbd-macro")
        # search and replace
        ,
        "replace":
        Emacs("query-replace"),
        "replace regex":
        Emacs("query-replace-regexp")
    }
    defaults = {"text": "", "0to10000": 0, "1to10": 1, "1to10000": 1}
    extras = [
        chc_base.text, chc_base._0to10000, chc_base._1to10, chc_base._1to10000,
        chc_base.letter_or_digit, chc_base.common_file
    ]
Ejemplo n.º 20
0
class EmacsNavigatingKeysRule(MappingRule):
    mapping = {
        # Words
        "foo [<1to100>]":
        Emacs("forward-word:%(1to100)d"),
        "sell foo [<1to100>]":
        K("sc-right:%(1to100)d"),
        "dee foo [<1to100>]":
        K("sc-right:%(1to100)d, backspace"),
        "bar [<1to100>]":
        Emacs("backward-word:%(1to100)d"),
        "sell bar [<1to100>]":
        K("sc-left:%(1to100)d"),
        "dee bar [<1to100>]":
        K("sc-left:%(1to100)d, backspace"),
        "sellword [<1to100>]":
        K("c-left") + K("sc-right:%(1to100)d")
        # Lines
        ,
        "home":
        Emacs("move-beginning-of-line"),
        "end":
        Emacs("move-end-of-line"),
        "u-end":
        K("up") + Emacs("move-end-of-line"),
        "de-end":
        K("down") + Emacs("move-end-of-line"),
        "sellome":
        K("s-home"),
        "deelome":
        K("s-home, backspace"),
        "sellend":
        K("s-end"),
        "deelend":
        K("s-end, backspace"),
        "cleeline":
        K("home") + K("s-down:%(0to100)d") + K("s-end") +
        K("backspace:2,enter"),
        "selline [<0to100>]":
        K("home") + K("s-down:%(0to100)d") + K("s-end"),
        "deeline [<0to100>]":
        K("home") + K("s-down:%(0to100)d") + K("s-end") + K("backspace:2"),
        "coline [<0to100>]":
        K("home") + K("s-down:%(0to100)d") + K("s-end") + K("c-c"),
        "dupline  [<0to100>] [<1to10>]":
        K("home") + K("s-down:%(0to100)d") + K("s-end") + P("20") + K("c-c") +
        P("20") + K("enter") +
        K("c-v:%(1to10)d")  # c-c needs to be isolated with medium pauses!!!
        # Line breaks
        ,
        "eslap":
        Emacs("move-end-of-line") + K("enter"),
        "dotslap":
        Emacs("move-end-of-line") + K("dot, enter"),
        "camslap":
        Emacs("move-end-of-line") + K("comma, enter"),
        "semslap":
        Emacs("move-end-of-line") + T(";") + K("enter"),
        "coalslap":
        Emacs("move-end-of-line") + K("colon, enter")
        # Special line breaks
        ,
        "slah (cam | cama)":
        Emacs("move-end-of-line") + K("enter") + T(", "),
        "(slah amp | slamper)":
        Emacs("move-end-of-line") + K("enter") + T("& "),
        "slah amp amp":
        Emacs("move-end-of-line") + K("enter") + T("&& "),
        "slah pipe":
        Emacs("move-end-of-line") + K("enter") + T("| "),
        "slah pipe pipe":
        Emacs("move-end-of-line") + K("enter") + T("|| "),
        "slah plus":
        Emacs("move-end-of-line") + K("enter") + T("+ "),
        "slah minus":
        Emacs("move-end-of-line") + K("enter") + T("- ")
        # Pages
        ,
        "go to home":
        Emacs("beginning-of-buffer"),
        "go to end":
        Emacs("end-of-buffer"),
        "sell-all":
        Emacs("mark-whole-buffer")
    }
    defaults = {"0to100": 0, "1to10": 1, "1to100": 1}
    extras = [chc_base._0to100, chc_base._1to10, chc_base._1to100]
Ejemplo n.º 21
0
def attribute_with_content(attribute, text):
    T(' %(attribute)s=""').execute()
    K("left").execute()
Ejemplo n.º 22
0
class DiredRule(MappingRule):
    mapping = {
        "die [<common_folder>]":
        Emacs("dired") + T("%(common_folder)s") + K("enter"),
        "die to":
        Emacs("dired-goto-file"),
        "die tox <text>":
        Emacs("dired-goto-file") + T("%(text)s\n"),
        "die find":
        Emacs("dired-isearch-filenames"),
        "die up":
        Emacs("dired-up-directory-reuse-dir-buffer"),
        "die image[s]":
        Emacs("image-dired"),
        "die this image[s]":
        Emacs("image-dired-display-thumbs"),
        "die flag":
        Emacs("dired-flag-file-deletion"),
        "die unflag":
        Emacs("dired-unmark"),
        "die unflag all":
        Emacs("dired-unmark-all-marks"),
        "die unflag back":
        Emacs("dired-unmark-backward"),
        "die flag delete":
        Emacs("dired-do-flagged-delete"),
        "die flag backup":
        Emacs("dired-flag-backup-files"),
        "die flag auto save":
        Emacs("dired-flag-auto-save-files"),
        "die flag regex":
        Emacs("dired-flag-files-regexp"),
        "die next flag":
        Emacs("dired-next-marked-file"),
        "die pre flag":
        Emacs("dired-prev-marked-file"),
        "die undo":
        Emacs("dired-undo"),
        "(die cop | die copy)":
        Emacs("dired-do-copy"),
        "(die dell | die delete)":
        Emacs("dired-do-delete"),
        "(die re | die rename)":
        Emacs("dired-do-renamed"),
        "(die hard | die hard link )":
        Emacs("dired-do-hardlink"),
        "(die sim | die  sym link)":
        Emacs("dired-do-symlink"),
        "die mod":
        Emacs("dired-do-chmod"),
        "(die own | die owner)":
        Emacs("dired-do-chown"),
        "die group":
        Emacs("dired-do-chgrp"),
        "die touch":
        Emacs("dired-do-touch"),
        "die print":
        Emacs("dired-do-print"),
        "die compress":
        Emacs("dired-do-compress"),
        "die encrypt":
        Emacs("dired-do-encrypt"),
        "die decrypt":
        Emacs("dired-do-decrypt"),
        "die sign":
        Emacs("dired-do-sign"),
        "die verify":
        Emacs("dired-do-verify"),
        "die load":
        Emacs("dired-do-load"),
        "die compile":
        Emacs("dired-do-compile"),
        "die search":
        Emacs("dired-do-search"),
        "die query":
        Emacs("dired-do-query-replace-regexp"),
        "die shell":
        Emacs("dired-do-shell-command"),
        "die refresh":
        Emacs("revert-buffer"),
        "die order":
        Emacs("dired-sort-toggle-or-edit"),
        "(die die | die make directory)":
        Emacs("dired-create-directory"),
        "die (op | open)":
        Emacs("dired-find-file"),
        "die (op | open) other":
        Emacs("dired-find-file-other-window"),
        "die (win | windows)":
        Emacs("dired-w32-browser"),
        "die (win | windows) same":
        Emacs("dired-w32-browser-reuse-dir-buffer"),
        "die (ex | explorer)":
        Emacs("dired-w32explore"),
        "(direct | directory) <common_folder>":
        T("%(common_folder)s\n")
    }
    defaults = {"text": "", "folder": ""}
    extras = [chc_base.text, chc_base.common_folder]
Ejemplo n.º 23
0
class HtmlCoreRule(MappingRule):
    mapping = {
        # doctype
        "doc type":
        T("<!DOCTYPE >") + K("left"),
        "doc type five":
        T("<!DOCTYPE html>"),
        "doc type four [strict]":
        T('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
          ),
        "H doc type four loose":
        T('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
          ),
        "doc type four frames":
        T('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
          ),
        "doc type X one [strict]":
        T('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
          ),
        "doc type X one loose":
        T('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
          ),
        "doc type X one frames":
        T('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
          ),
        "doc type X one one":
        T('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
          ),
        "comment":
        T("<!--   -->") + K("left:5"),
        "comment <text>":
        T("<!-- %(text)s -->"),
        "open comment":
        T("<!-- "),
        "close comment":
        T(" -->")
        # html_elements
        ,
        "(open | start) <html_element>":
        T("<%(html_element)s>"),
        "(close | end | stop) <html_element>":
        T("</%(html_element)s>"),
        "<html_element>":
        T("<%(html_element)s></"),
        "<html_element> ID":
        T('<%(html_element)s id="">') + K("left:2"),
        "<html_element> ID <text>":
        T('<%(html_element)s id="%(text)s"></'),
        "<html_element> class":
        T('<%(html_element)s class="">') + K("left:2"),
        "<html_element> class <text>":
        T('<%(html_element)s class="%(text)s"></')
        # attributes
        ,
        "<html_attribute>":
        T(' %(html_attribute)s=""') + K("left"),
        "<html_attribute> [equals] <text>":
        T(' %(html_attribute)s="%(text)s"'),
        "download":
        T(' download'),
        "download <text>":
        T(' download="%(text)s"'),
        "HREF":
        T(' href=""') + K("left"),
        "HREF <text>":
        T(' href="%(text)s"'),
        "HREF lang":
        T(' hreflang=""') + K("left"),
        "HREF lang <html_language_code>":
        T(' hreflang="%(html_language_code)s"'),
        "HREF lang <text>":
        T(' hreflang="%(text)s"'),
        "media":
        T(' media=""') + K("left"),
        "media <text>":
        T(' media="%(text)s"'),
        "(relation | relationship)":
        T(' rel=""') + K("left"),
        "(relation | reltionship) <html_relationship>":
        K(' rel="%(html_relationship)s"'),
        "target":
        T(' target=""') + K("left"),
        "target <html_target>":
        T(' target="%(html_target)s"'),
        "media type":
        T(' type=""') + K("left")
        # title
        ,
        "title":
        T("<title></")
        # meta
        # page
        ,
        "diff":
        T('<div></'),
        "diff ID [<text>]":
        T('<div id="%(text)s"></'),
        "diff class [<text>]":
        T('<div class="%(text)s"></')
    }
    defaults = {"text": ""}
    extras = [
        chc_base.text, chc_web.html_element, chc_web.html_attribute,
        chc_web.html_language_code, chc_web.html_relationship,
        chc_web.html_target
    ]
Ejemplo n.º 24
0
class NavigatingKeysRule(MappingRule):
    mapping = {
        # Char
        "right [<1to100>]":
        K("right:%(1to100)d"),
        "left [<1to100>]":
        K("left:%(1to100)d"),
        "up [<1to100>]":
        K("up:%(1to100)d"),
        "down [<1to100>]":
        K("down:%(1to100)d"),
        "chuck [<1to100>]":
        K("delete:%(1to100)d"),
        "chook [<1to100>]":
        K("backspace:%(1to100)d")
        # Words
        ,
        "foo [<1to100>]":
        K("c-right:%(1to100)d"),
        "sell foo [<1to100>]":
        K("sc-right:%(1to100)d"),
        "dee foo [<1to100>]":
        K("sc-right:%(1to100)d, backspace"),
        "bar [<1to100>]":
        K("c-left:%(1to100)d"),
        "sell bar [<1to100>]":
        K("sc-left:%(1to100)d"),
        "dee bar [<1to100>]":
        K("sc-left:%(1to100)d, backspace"),
        "sellword [<1to100>]":
        K("c-left") + K("sc-right:%(1to100)d")
        # Lines
        ,
        "home":
        K("home"),
        "end":
        K("end"),
        "u-end":
        K("up,end"),
        "de-end":
        K("down,end"),
        "sellome":
        K("s-home"),
        "deelome":
        K("s-home, backspace"),
        "sellend":
        K("s-end"),
        "deelend":
        K("s-end, backspace"),
        "cleeline":
        K("home") + K("s-down:%(0to100)d") + K("s-end") +
        K("backspace:2,enter"),
        "selline [<0to100>]":
        K("home") + K("s-down:%(0to100)d") + K("s-end"),
        "deeline [<0to100>]":
        K("home") + K("s-down:%(0to100)d") + K("s-end") + K("backspace:2"),
        "coline [<0to100>]":
        K("home") + K("s-down:%(0to100)d") + K("s-end") + K("c-c"),
        "cutline [<0to100>]":
        K("home") + K("s-down:%(0to100)d") + K("s-end") + K("c-x"),
        "dupline  [<0to100>] [<1to10>]":
        K("home") + K("s-down:%(0to100)d") + K("s-end") + P("20") + K("c-c") +
        P("20") + K("enter") +
        K("c-v:%(1to10)d")  # c-c needs to be isolated with medium pauses!!!
        # Line breaks
        ,
        "eslap":
        K("end, enter"),
        "dotslap":
        K("end, dot, enter"),
        "camslap":
        K("end, comma, enter"),
        "semslap":
        K("end") + T(";") + K("enter"),
        "coalslap":
        K("end, colon, enter"),
        "altslap":
        K("a,enter"),
        "(downslap | deeslap)":
        K("down,enter")
        # Special line breaks
        ,
        "slah (cam | cama)":
        K("end,enter") + T(", "),
        "(slah amp | slamper)":
        K("end,enter") + T("& "),
        "slah amp amp":
        K("end,enter") + T("&& "),
        "slah pipe":
        K("end,enter") + T("| "),
        "slah pipe pipe":
        K("end,enter") + T("|| "),
        "slah plus":
        K("end,enter") + T("+ "),
        "slah minus":
        K("end,enter") + T("- ")
        # Pages
        ,
        "(page up | pup) [<1to100>]":
        K("pgup:%(1to100)d"),
        "(page down | poun) [<1to100>]":
        K("pgdown:%(1to100)d"),
        "go to home":
        K("c-home"),
        "go to end":
        K("c-end"),
        "sell-all":
        K("c-a")
    }
    defaults = {"0to100": 1, "1to10": 1, "1to100": 1}
    extras = [chc_base._0to100, chc_base._1to10, chc_base._1to100]