Added save file command

master
Jeremy Hayes 2022-02-10 09:47:18 -06:00
parent d9c822f4d7
commit 5d513dc1a1
3 changed files with 17 additions and 3 deletions

View File

@ -18,12 +18,12 @@ class UsefulStuff(MappingRule):
"arrow": Text("->"),
"double arrow": Text("=>"),
"enter|slap": Key("enter"),
"spank": Key("space"),
"east": Key("end"),
"west": Key("home"),
"format": Key("ctrl") + Key("alt") + Key("f"),
"save file": Key("ctrl") + Key("s"),
"hash": Key("#"),
"punch": Key(","),
"hash": Text("#"),
"punch": Text(","),
}
globalStuff = Grammar("useful custom global commands") # Create a grammar to contain the command rule.

View File

@ -113,6 +113,7 @@ config.cmd.map = Item(
"paste": release + Key("c-v"),
"scratch": release + Key("c-z"),
"no scratch": release + Key("c-y"),
"save file": release + Key("c-s"),
"duplicate <n>": release + Key("c-c, c-v:%(n)d"),
"copy": release + Key("c-c"),
"cut": release + Key("c-x"),

View File

@ -40,6 +40,14 @@ def caps_first_format(command): # Callback when command is spoken.
printer = Text(upperString)
printer.execute()
# Voice command rule for first caracter of the first word.
def dictate_format(command): # Callback when command is spoken.
textToPrint = command
someString = str(textToPrint)
upperString = someString.capitalize()
printer = Text(upperString)
printer.execute()
# Voice command rule for "middle_underscores" naming convention.
def middle_underscores(command): # Callback when command is spoken.
textToPrint = command
@ -111,6 +119,11 @@ class ProgrammingNamingConventions(MappingRule):
"caps first <command> <symbol>": Function(caps_first_format) + Text("%(symbol)s"),
"<symbol> caps first <command>": Text("%(symbol)s") + Function(caps_first_format),
#this command capitalizes the 1st letter of first word example: Test value
"dictate <command>": Function(dictate_format),
"dictate <command> <symbol>": Function(dictate_format) + Text("%(symbol)s"),
"<symbol> dictate <command>": Text("%(symbol)s") + Function(dictate_format),
#this command capitalizes the 1st letter of each word and removes spaces example: TestValue
"camel <command>": Function(camel_format),
"camel <command> <symbol>": Function(camel_format) + Text("%(symbol)s"),