Skip to content

Commit

Permalink
tweak a couple commands in VS code (#477)
Browse files Browse the repository at this point in the history
* tweak a couple commands in VS code

* fix a couple VS code descriptions

* add expand and shrink selection commands

* fixed CCR/non-CCR bug, and one command, and move another
  • Loading branch information
alexboche authored and LexiconCode committed Jun 26, 2019
1 parent 843152a commit c72bd12
Showing 1 changed file with 81 additions and 48 deletions.
129 changes: 81 additions & 48 deletions castervoice/apps/vscode.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class VSCodeNonCcrRule(MergeRule):
"key mappings":
R(Key("c-k, c-s:2")),
"settings":
R(Key("a-f, p, s")),
R(Key("a-f, p, s, enter"), rdescript="VS Code: User/workspace Settings"),
"snippets":
R(Key("a-f, p, s:2")),
R(Key("a-f, p, s:2, enter"), rdescript="VS Code: User Snippets"),
"extensions":
R(Key("cs-x")),
"search details":
Expand All @@ -65,10 +65,16 @@ class VSCodeNonCcrRule(MergeRule):
R(Key("c-k, z")),

# File Management
"copy path":
R(Key("c-k, p")),
"[open] command palette":
R(Key("cs-p")),
"(open [file] | go to [tab]) [<text>]":
R(Key("c-p") + Text("%(text)s")),
R(Key("cs-p"), rdescript="VS Code: Command Palette"),
"(open file | go to [tab]) [<text>]":
R(Key("c-p") + Text("%(text)s"), rdescript="VS Code: Go to File without using dialogbox"),
"open dialogue":
R(Key("c-o"), rdescript="VS Code: open file dialogbox"),
"open folder":
R(Key("c-k, c-o"), rdescript="VS Code: Open folder"),
"Save and close":
R(Key("c-s/10, c-w")),
"new file":
Expand Down Expand Up @@ -99,8 +105,6 @@ class VSCodeNonCcrRule(MergeRule):
R(Key("space, c-z")),
"keep preview open":
R(Key("c-k, enter")),
"copy path":
R(Key("c-k, p")),
"windows explorer here":
R(Key("c-k, r")),
"show active file in new window":
Expand All @@ -123,11 +127,11 @@ class VSCodeNonCcrRule(MergeRule):
R(Key("a-enter")),

"toggle case sensitive":
R(Key("a-c")),
R(Key("a-c"), rdescript="VS Code: Toggle Find Case Sensitive"),
"toggle regex":
R(Key("a-r")),
R(Key("a-r"), rdescript="VS Code: Toggle Find Regular Expressions"),
"toggle whole word":
R(Key("a-w")),
R(Key("a-w"), rdescript="VS Code: Toggle Find Whole Word"),

"(find | jump [to]) next <text>":
R(Function(findNthToken, n=1, direction="forward")),
Expand All @@ -150,9 +154,11 @@ class VSCodeNonCcrRule(MergeRule):
"(prior | previous | un) pane":
R(Key("c-k, c-right")),
"shift group left":
R(Key("c-k, left")),
"shift group left":
R(Key("c-k, right")
R(Key("c-k, left"),
rdescript="VS Code: Shift Current Group of Tabs to the Left E.g. Swap with Pane to the Left"),
"shift group right":
R(Key("c-k, right"),
rdescript="VS Code: Shift Current Group of Tabs to the Right E.g. Swap with Pane to the Right"
),
"<nth> tab":
R(Key("c-%(nth)s")),
Expand Down Expand Up @@ -195,9 +201,11 @@ class VSCodeNonCcrRule(MergeRule):
"stopper":
R(Key("s-f5")),
"continue":
R(Key("f5")),
"show hover":
R(Key("c-k, c-i")),
R(Key("f5"), rdescript="VS Code: Start/Continue"),
"(show hover|mouse hover|hover mouse)":
R(Key("c-k, c-i"),
rdescript="Show the little box as if you are hovering your mouse over the place where the cursor (As opposed to the mouse pointer) currently is"
),
"[show] problems [panel]":
R(Key("cs-m")),
"next error":
Expand Down Expand Up @@ -279,88 +287,113 @@ class VSCodeNonCcrRule(MergeRule):
]
defaults = {"n": 1, "ln2": "", "mim": "", "text": ""}


class VSCodeCcrRule(MergeRule):
pronunciation = "visual studio code continuous"
mwith = CCRMerger.CORE
non = VSCodeNonCcrRule

mapping = {
# Note: If you get the bad grammar grammar too complex error, move some of these commands into the non-CCR rule
# cursor/line navigation
"scroll up [<n>]":
R(Key("c-up") * Repeat(extra='n')),
R(Key("c-up") * Repeat(extra='n'),
rdescript="VS Code: Scroll Up One Line at a Time"),
"scroll down [<n>]":
R(Key("c-down") * Repeat(extra='n')),
R(Key("c-down") * Repeat(extra='n'),
rdescript="VS Code: Scroll Down One Line at a Time"),
"scroll page up [<n>]":
R(Key("a-pgup") * Repeat(extra='n')),
R(Key("a-pgup") * Repeat(extra='n'),
rdescript="VS Code: Scroll Up One Page Up at a Time"),
"scroll page down [<n>]":
R(Key("a-pgdown") * Repeat(extra='n')),
R(Key("a-pgdown") * Repeat(extra='n'),
rdescript="VS Code: Scroll Down One Page Down At a Time"),
"(unindent|outdent) [<n>]":
R(Key("s-tab") * Repeat(extra='n')),
"comment line":
R(Key("c-slash")),
R(Key("home, s-tab:%(n)s"), rdescript="VS Code: Unindent"),
"comment [line]":
R(Key("c-slash"), rdescript="VS Code: Line Comment"),
"block comment":
R(Key("sa-a")),
R(Key("sa-a"), rdescript="VS Code: Block Comment"),
# Multi-cursor and selection
"cursor above [<n>]":
R(Key("ca-up") * Repeat(extra='n')),
R(Key("ca-up") * Repeat(extra='n'),
rdescript="VS Code: Insert Cursor Above"),
"cursor below [<n>]":
R(Key("ca-down") * Repeat(extra='n')),
R(Key("ca-down") * Repeat(extra='n'),
rdescript="VS Code: Insert Cursor Above"),
"remove cursor":
R(Key("csa-down")), # not sure if this command works always; also try csa-up
R(Key("csa-down"),
rdescript="VS Code: Remove Cursor"), # not sure if this command works always; also try csa-up
# csa-down/up seems to work sometimes to remove 1 of the cursors
# but I don't really understand how this works
"tall cursor up":
R(Key("csa-pgup")),
R(Key("csa-pgup"), rdescript="VS Code: Add Cursors All The Way Up"),
"tall cursor down":
R(Key("csa-pgdown")),
R(Key("csa-pgdown"), rdescript="VS Code: Add Cursors All The Way Down"),

"expand [<n>]": R(Key("sa-right"),
rdescript="highlight current word(s)") * Repeat(extra='n'),
"shrink [<n>]": R(Key("sa-left"),
rdescript="shrink the previous highlighting range or unhighlight") * Repeat(extra='n'),

# Command below requires "brackets select" extension for VS code
"select [in] brackets [<n>]":
R(Key("ca-a") * Repeat(extra='n')
R(Key("ca-a") * Repeat(extra='n'),
rdescript="VS Code: Select in between parable punctuation inclusive using 'brackets select' extension"
)*Repeat(extra='n'),
"all current selection":
R(Key("c-l")),
R(Key("c-l"), rdescript="VS Code: Select All Occurrences of Current Selection"),
"all current word":
R(Key("c-f2")),
R(Key("c-f2"), rdescript="VS Code: Select All Occurrences of Current Word"),
"select next [<n>]":
R(Key("c-f3") * Repeat(extra='n')),
R(Key("c-f3") * Repeat(extra='n'),
rdescript="VS Code: Select Next Occurrence of Current Word"),
"go to next [<n>]":
R(Key("sa-right/2, c-f3, c-left/2, escape") * Repeat(extra='n')),
R(Key("sa-right/2, c-f3, c-left/2, escape") * Repeat(extra='n'),
rdescript="VS Code: Go to Next Occurrence of Current Word"),
# may or may not want the escape afterwards to close the find box
# note the above command might sometimes be off by one so you have to say one higher
# than what you mean e.g. if the cursor is at the beginning of the word rather
# than in the middle or end, you will have to say "next word two" to get to the next word
"select prior [<n>]":
R(Key("cs-f3")),
R(Key("cs-f3"), rdescript="VS Code: Select Prior Occurrence of Current Word"),
"go to prior [<n>]":
R(Key("sa-right/2, cs-f3, c-left/2, escape") * Repeat(extra='n')),
R(Key("sa-right/2, cs-f3, c-left/2, escape") * Repeat(extra='n'),
rdescript="VS Code: Go to Prior Occurrence of Current Word"),
# may or may not want the escape afterwards to close the find box
"cursor all":
R(Key("cs-l")),
R(Key("cs-l"),
rdescript="VS Code: Add Cursor to All Occurrences of Current Selection"),
"next cursor [<n>]":
R(Key("c-d") * Repeat(extra='n')),
R(Key("c-d") * Repeat(extra='n'),
rdescript="VS Code: Add Cursor to Next Occurrence of Current Selection"),
"indent [<n>]":
R(Key("tab") * Repeat(extra='n')),
R(Key("home, tab:%(n)s"), rdescript="VS Code: Indent"),
"hard delete [<n>]":
R(Key("s-del")),
R(Key("s-del"), rdescript="VS Code: Eliminates Line not Just the Text on it"),
"copy line up [<n>]":
R(Key("sa-up") * Repeat(extra='n')),
R(Key("sa-up") * Repeat(extra='n'),
rdescript="VS Code: Duplicate Line Above"),
"copy line up [<n>]":
R(Key("sa-down") * Repeat(extra='n')),
R(Key("sa-down") * Repeat(extra='n'),
rdescript="VS Code: Duplicate Line Below"),
"switch line down [<n>]":
R(Key("a-down") * Repeat(extra='n')),
R(Key("a-down") * Repeat(extra='n'),
rdescript="VS Code: Switch Line With the One Below it"),
"switch line up [<n>]":
R(Key("a-up") * Repeat(extra='n')),
R(Key("a-up") * Repeat(extra='n'),
rdescript="VS Code: Switch Line With the One Above it"),
"match bracket":
R(Key("cs-backslash")),
R(Key("cs-backslash"), rdescript="VS Code: Jump to Matching Bracket"),

# commands for selecting between parable characters using "quick and simple text selection" VScode extension (required)
# repetition of these commands by saying the number expands the selection to include the text between the next (i.e. outer) set of parable characters of the given type
"select between <between_parables> [<n>]":
R(Key("c-k, %(between_parables)s") * Repeat(extra='n')
R(Key("c-k, %(between_parables)s") * Repeat(extra='n'),
rdescript="VS Code: Select between parentheses noninclusive using 'quick and simple text selection' VScode extension"
),
"select around <around_parables> [<n>]":
R(Key("c-k, %(around_parables)s") * Repeat(extra='n')
R(Key("c-k, %(around_parables)s") * Repeat(extra='n'),
rdescript="VS Code: Select between parentheses inclusive using 'quick and simple text selection' VScode extension"
),
}
extras = [
Expand Down

0 comments on commit c72bd12

Please sign in to comment.