-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor version bump - Major feature upgrades!
The next release is likely to be 0.6.0. Added Prolog and VHDL CCR grammars. JavaScript CCR updates. VS Code support. Mostly internal overhaul of Atom support. Improved Unicode support.
- Loading branch information
Showing
19 changed files
with
1,233 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[style] | ||
based_on_style=pep8 | ||
column_limit=90 | ||
indent_dictionary_value=True | ||
split_complex_comprehension=True | ||
no_spaces_around_selected_binary_operators=*,/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
""" | ||
__author__ = 'LexiconCode' | ||
Command-module for Gitter | ||
Official Site "https://gitter.im/" | ||
""" | ||
#--------------------------------------------------------------------------- | ||
|
||
from dragonfly import AppContext, Dictation, Grammar, Key, MappingRule, Text | ||
|
||
from caster.lib import control, settings | ||
from caster.lib.dfplus.merge import gfilter | ||
from caster.lib.dfplus.merge.mergerule import MergeRule | ||
from caster.lib.dfplus.state.short import R | ||
|
||
|
||
class GitterRule(MergeRule): | ||
pronunciation = "Gitter" | ||
|
||
mapping = { | ||
"bold": | ||
R(Text("****") + Key("left:2"), rdescript="Gitter: Bold"), | ||
"emphasize": | ||
R(Text("**") + Key("left"), rdescript="Gitter: Italicize"), | ||
# "header": R(Text( "" ), rdescript="Gitter: Header"), # H1 ## H2 ### H3 | ||
"insert item": | ||
R(Text("* "), rdescript="Gitter: Insert Item"), | ||
"block quote": | ||
R(Text("> "), rdescript="Gitter: Block Quote"), | ||
"mention": | ||
R(Text("@"), rdescript="Gitter: Mention"), | ||
"insert link": | ||
R(Text("[]()") + Key("left:3"), rdescript="Gitter: Insert Link"), | ||
"insert image": | ||
R(Text("![]()") + Key("left:3"), rdescript="Gitter: Insert Image"), | ||
"insert code": | ||
R(Text("``") + Key("left"), rdescript="Gitter: Insert Code"), | ||
"formatted code": | ||
R(Text("```") + Key("s-enter"), rdescript="Gitter: Formatted Code"), | ||
} | ||
extras = [ | ||
Dictation("text"), | ||
] | ||
Defaults = {} | ||
|
||
|
||
#--------------------------------------------------------------------------- | ||
|
||
context = AppContext(executable="gitter") | ||
grammar = Grammar("gitter", context=context) | ||
|
||
if settings.SETTINGS["apps"]["gitter"]: | ||
if settings.SETTINGS["miscellaneous"]["rdp_mode"]: | ||
control.nexus().merger.add_global_rule(GitterRule()) | ||
print("added Gitter") | ||
else: | ||
rule = GitterRule(name="gitter") | ||
gfilter.run_on(rule) | ||
grammar.add_rule(rule) | ||
grammar.load() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
from dragonfly import (Grammar, AppContext, Dictation, Key, Text, Repeat, Function) | ||
|
||
from caster.lib import control | ||
from caster.lib import settings | ||
from caster.lib.dfplus.additions import IntegerRefST | ||
from caster.lib.dfplus.merge import gfilter | ||
from caster.lib.dfplus.merge.mergerule import MergeRule | ||
from caster.lib.dfplus.state.short import R | ||
|
||
def findNthToken(text, n, direction): | ||
Key("c-f").execute() | ||
Text("%(text)s").execute({"text": text}) | ||
if direction == "reverse": | ||
print("yeah? %(n)d") | ||
Key("s-enter:%(n)d").execute() | ||
else: | ||
Key("enter:%(n)d").execute() | ||
print("no? %(n)d") | ||
Key('escape').execute() | ||
|
||
class VisualStudioCodeRule(MergeRule): | ||
pronunciation = "visual studio code" | ||
|
||
mapping = { | ||
### ported from my dragonfly scripts | ||
# File management | ||
"[open] command palette": R(Key("cs-p"), rdescript="Visual Studio Code: Command Palette"), | ||
"(Open [file] | Go to [tab]) [<text>]": R(Key("c-p") + Text("%(text)s"), rdescript="Visual Studio Code: Go To File"), | ||
"Close tab": R(Key("c-w"), rdescript="Visual Studio Code: Close Tab"), | ||
"Save file": R(Key("c-s"), rdescript="Visual Studio Code: Save File"), | ||
"Save and close": R(Key("c-s/10, c-w"), rdescript="Visual Studio Code: Save And Close File"), | ||
|
||
# Search | ||
"(search | find in) [all] (files | codebase)": R(Key("cs-f"), rdescript="Visual Studio Code: Find in Codebase"), | ||
"(search | find) [file]": R(Key("c-f"), rdescript="Visual Studio Code: Find in File"), | ||
"(Find | Jump [to]) next <text>": R(Function(findNthToken, n=1, direction="forward"), rdescript="Visual Studio Code: Find Next"), | ||
"(Find | Jump [to]) previous <text>": R(Function(findNthToken, n=1, direction="reverse"), rdescript="Visual Studio Code: Find Previous"), | ||
|
||
# Tab management | ||
"nexta [<n>]": R(Key("c-pgdown"), rdescript="Visual Studio Code: Next Tab") * Repeat(extra="n"), # These would be next and previous tab but i have a conflict with chrome | ||
"prexta [<n>]": R(Key("c-pgup"), rdescript="Visual Studio Code: Previous Tab") * Repeat(extra="n"), | ||
"Close tab": R(Key("c-f4"), rdescript="Visual Studio Code: Close Tab"), | ||
"Exit preview": R(Key("space, c-z"), rdescript="Visual Studio Code: Exit Preview"), | ||
|
||
# moving around a file | ||
"(go to | jump | jump to) line <n>": R(Key("c-g") + Text("%(n)d") + Key("enter"), rdescript="Visual Studio Code: Go to Line"), | ||
"Go to definition": R(Key("f12"), rdescript="Visual Studio Code: Go to Definition"), | ||
"Go to required definition": R(Key("c-f12:2, c-right:5, left/50, f12"), rdescript="Visual Studio Code: Go to Required Definition"), | ||
"Go to (top | first line)": R(Key("c-home"), rdescript="Visual Studio Code: Go to Top"), | ||
"Go to ( bottom | last line)": R(Key("c-end"), rdescript="Visual Studio Code: Go to Bottom"), | ||
"ee-ol": R(Key("end"), rdescript="Visual Studio Code: End Of Line"), | ||
"beol": R(Key("home"), rdescript="Visual Studio Code: Beginning of Line"), | ||
"Go back [<n>]": R(Key("a-left"), rdescript="Visual Studio Code: Go Back") * Repeat(extra="n"), | ||
"Go forward [<n>]": R(Key("a-right"), rdescript="Visual Studio Code: Go Forward") * Repeat(extra="n"), | ||
|
||
# Formatting | ||
"indent [<n>]": R(Key("tab"), rdescript="Visual Studio Code: Indent") * Repeat(extra="n"), | ||
"Unindent [<n>]": R(Key("s-tab"), rdescript="Visual Studio Code: Unindent") * Repeat(extra="n"), | ||
"Comment": R(Key("c-slash"), rdescript="Visual Studio Code: Line Comment"), | ||
"Block comment": R(Key("sa-a"), rdescript="Visual Studio Code: Block Comment"), | ||
|
||
# Window Management | ||
"[toggle] full screen": R(Key("f11"), rdescript="Visual Studio Code:Fullscreen"), | ||
"[toggle] Zen mode": R(Key("c-k/3, z")), | ||
|
||
|
||
# Debugging | ||
"[toggle] breakpoint": R(Key("f9"), rdescript="Visual Studio Code:Breakpoint"), | ||
"step over [<n>]": R(Key("f10/50") * Repeat(extra="n"), rdescript="Visual Studio Code:Step Over"), | ||
"step into": R(Key("f11"), rdescript="Visual Studio Code:Step Into"), | ||
"step out [of]": R(Key("s-f11"), rdescript="Visual Studio Code:Step Out"), | ||
"resume": R(Key("f5"), rdescript="Visual Studio Code:Resume"), | ||
} | ||
extras = [ | ||
Dictation("text"), | ||
Dictation("mim"), | ||
IntegerRefST("n", 1, 1000), | ||
|
||
] | ||
defaults = { | ||
"n": 1, | ||
"mim":"", | ||
"text": "" | ||
} | ||
|
||
#--------------------------------------------------------------------------- | ||
|
||
context = AppContext(executable="code") | ||
grammar = Grammar("Visual Studio Code", context=context) | ||
if settings.SETTINGS["apps"]["visualstudiocode"]: | ||
if settings.SETTINGS["miscellaneous"]["rdp_mode"]: | ||
control.nexus().merger.add_global_rule(VisualStudioCodeRule()) | ||
else: | ||
rule = VisualStudioCodeRule(name="visualstudiocode") | ||
gfilter.run_on(rule) | ||
grammar.add_rule(rule) | ||
grammar.load() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
''' | ||
Created on Sep 2, 2015 | ||
@author: Gerrish | ||
''' | ||
from dragonfly import Key, Text, Dictation, MappingRule | ||
from dragonfly.actions.action_text import Text | ||
|
||
from caster.lib import control | ||
from caster.lib.dfplus.merge.mergerule import MergeRule | ||
from caster.lib.dfplus.state.short import R | ||
from caster.lib.ccr.standard import SymbolSpecs | ||
|
||
class PrologNon(MappingRule): | ||
mapping = { | ||
"Rule": R(Text("() :-.")+Key("left/6"),rdescript="Prolog: rule"), | ||
SymbolSpecs.IF: R(Text("( ")+Key("enter")+Text(";")+Key("enter")+Text(")"),rdescript="Prolog: IF"), | ||
} | ||
|
||
|
||
|
||
class Prolog(MergeRule): | ||
pronunciation = "prolog" | ||
|
||
non = PrologNon | ||
|
||
mapping = { | ||
"implies": R(Text(":-"), rdescript="Prolog: Select"), | ||
"comment": R(Text("%"), rdescript="Prolog: Line Comment"), | ||
"Open Block comment": R(Text("/* "),rdescript="Prolog: Line Comment"), | ||
"Close Block comment": R(Text("*\ "),rdescript="Prolog: Line Comment"), | ||
"Anonymous": R(Text("_"), rdescript="Prolog: Anonymous"), | ||
"Not": R(Text("\+"), rdescript="Prolog: Not"), | ||
"cut": R(Text("!"), rdescript="Prolog: cut "), | ||
"Or": R(Text(";"), rdescript="Prolog: Or"), | ||
"Fail": R(Text("Fail"), rdescript="Prolog: Fail") | ||
} | ||
|
||
extras = [] | ||
defaults = {} | ||
|
||
control.nexus().merger.add_global_rule(Prolog()) |
Empty file.
Oops, something went wrong.