Skip to content

Commit

Permalink
commands: remap {a-,}space to {a-,}, (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
71 committed Nov 2, 2022
1 parent 73d32ad commit 5779d9c
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 50 deletions.
8 changes: 3 additions & 5 deletions package.build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,14 +714,12 @@ export const pkg = (modules: Builder.ParsedModule[]) => ({
keybindings: (() => {
const keybindings = modules.flatMap((module) => module.keybindings),
alphanum = [..."ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"],
symbols = [...",'-=", "Space", "NumPad_Add", "NumPad_Subtract"],
keysToAssign = new Set([
...alphanum,
...alphanum.map((x) => `Shift+${x}`),
...",'-",
"Shift+=",
"Shift+Space",
"NumPad_Add",
"NumPad_Subtract",
...symbols,
...symbols.map((x) => `Shift+${x}`),
]);

for (const keybinding of keybindings) {
Expand Down
29 changes: 22 additions & 7 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/api/data/commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ selections.clear.main:
keys:
qwerty: |-
`a-space` (kakoune: normal)
`a-,` (kakoune: normal)
selections.clear.secondary:
title:
Expand All @@ -1976,7 +1976,7 @@ selections.clear.secondary:
keys:
qwerty: |-
`space` (kakoune: normal)
`,` (kakoune: normal)
selections.copy:
title:
Expand Down Expand Up @@ -2058,12 +2058,12 @@ selections.filter:
#### Variants
| Title | Identifier | Keybinding | Commands |
| -------------------------- | ----------------------- | --------------------------- | ------------------------------------------------------------------------ |
| Keep matching selections | `filter.regexp` | `a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
| Clear matching selections | `filter.regexp.inverse` | `s-a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
| Clear secondary selections | `clear.secondary` | `space` (kakoune: normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
| Clear main selections | `clear.main` | `a-space` (kakoune: normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |
| Title | Identifier | Keybinding | Commands |
| -------------------------- | ----------------------- | --------------------------| ------------------------------------------------------------------------ |
| Keep matching selections | `filter.regexp` | `a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
| Clear matching selections | `filter.regexp.inverse` | `s-a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
| Clear secondary selections | `clear.secondary` | `,` (kakoune: normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
| Clear main selections | `clear.main` | `a-,` (kakoune: normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |
selections.filter.regexp:
title:
Expand Down
16 changes: 8 additions & 8 deletions src/commands/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/commands/layouts/azerty.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ selections are empty</td><td></td></tr>
<tr><td><a href="#selections.save"><code>selections.save</code></a></td><td>Save selections</td><td><code>Shift+Z</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="#selections.saveText"><code>selections.saveText</code></a></td><td>Copy selections text</td><td><code>Y</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="#selections.select"><code>selections.select</code></a></td><td>Select within selections</td><td></td></tr>
<tr><td><a href="../selections.ts#L303"><code>selections.clear.main</code></a></td><td>Clear main selections</td><td><code>Alt+Space</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L302"><code>selections.clear.secondary</code></a></td><td>Clear secondary selections</td><td><code>Space</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L303"><code>selections.clear.main</code></a></td><td>Clear main selections</td><td><code>Alt+,</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L302"><code>selections.clear.secondary</code></a></td><td>Clear secondary selections</td><td><code>,</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L808"><code>selections.copy.above</code></a></td><td>Copy selections above</td><td><code>Shift+Alt+C</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L660"><code>selections.faceBackward</code></a></td><td>Backward selections</td><td></td></tr>
<tr><td><a href="../selections.ts#L659"><code>selections.faceForward</code></a></td><td>Forward selections</td><td><code>Shift+Alt+;</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
Expand Down Expand Up @@ -1440,12 +1440,12 @@ Filter selections.

#### Variants

| Title | Identifier | Keybinding | Commands |
| -------------------------- | ----------------------- | --------------------------- | ------------------------------------------------------------------------ |
| Keep matching selections | `filter.regexp` | `a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
| Clear matching selections | `filter.regexp.inverse` | `s-a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
| Clear secondary selections | `clear.secondary` | `space` (kakoune: normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
| Clear main selections | `clear.main` | `a-space` (kakoune: normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |
| Title | Identifier | Keybinding | Commands |
| -------------------------- | ----------------------- | --------------------------| ------------------------------------------------------------------------ |
| Keep matching selections | `filter.regexp` | `a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
| Clear matching selections | `filter.regexp.inverse` | `s-a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
| Clear secondary selections | `clear.secondary` | `,` (kakoune: normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
| Clear main selections | `clear.main` | `a-,` (kakoune: normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |

This command:
- accepts an argument of type `{ expression?: string }`.
Expand Down
16 changes: 8 additions & 8 deletions src/commands/layouts/qwerty.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ selections are empty</td><td></td></tr>
<tr><td><a href="#selections.save"><code>selections.save</code></a></td><td>Save selections</td><td><code>Shift+Z</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="#selections.saveText"><code>selections.saveText</code></a></td><td>Copy selections text</td><td><code>Y</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="#selections.select"><code>selections.select</code></a></td><td>Select within selections</td><td></td></tr>
<tr><td><a href="../selections.ts#L303"><code>selections.clear.main</code></a></td><td>Clear main selections</td><td><code>Alt+Space</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L302"><code>selections.clear.secondary</code></a></td><td>Clear secondary selections</td><td><code>Space</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L303"><code>selections.clear.main</code></a></td><td>Clear main selections</td><td><code>Alt+,</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L302"><code>selections.clear.secondary</code></a></td><td>Clear secondary selections</td><td><code>,</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L808"><code>selections.copy.above</code></a></td><td>Copy selections above</td><td><code>Shift+Alt+C</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
<tr><td><a href="../selections.ts#L660"><code>selections.faceBackward</code></a></td><td>Backward selections</td><td></td></tr>
<tr><td><a href="../selections.ts#L659"><code>selections.faceForward</code></a></td><td>Forward selections</td><td><code>Shift+Alt+;</code> (<code>editorTextFocus && dance.mode == 'normal'</code>)</td></tr>
Expand Down Expand Up @@ -1440,12 +1440,12 @@ Filter selections.

#### Variants

| Title | Identifier | Keybinding | Commands |
| -------------------------- | ----------------------- | --------------------------- | ------------------------------------------------------------------------ |
| Keep matching selections | `filter.regexp` | `a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
| Clear matching selections | `filter.regexp.inverse` | `s-a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
| Clear secondary selections | `clear.secondary` | `space` (kakoune: normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
| Clear main selections | `clear.main` | `a-space` (kakoune: normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |
| Title | Identifier | Keybinding | Commands |
| -------------------------- | ----------------------- | --------------------------| ------------------------------------------------------------------------ |
| Keep matching selections | `filter.regexp` | `a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
| Clear matching selections | `filter.regexp.inverse` | `s-a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
| Clear secondary selections | `clear.secondary` | `,` (kakoune: normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
| Clear main selections | `clear.main` | `a-,` (kakoune: normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |

This command:
- accepts an argument of type `{ expression?: string }`.
Expand Down
12 changes: 6 additions & 6 deletions src/commands/selections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,12 @@ const filterHistory: string[] = [];
*
* #### Variants
*
* | Title | Identifier | Keybinding | Commands |
* | -------------------------- | ----------------------- | --------------------------- | ------------------------------------------------------------------------ |
* | Keep matching selections | `filter.regexp` | `a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
* | Clear matching selections | `filter.regexp.inverse` | `s-a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
* | Clear secondary selections | `clear.secondary` | `space` (kakoune: normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
* | Clear main selections | `clear.main` | `a-space` (kakoune: normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |
* | Title | Identifier | Keybinding | Commands |
* | -------------------------- | ----------------------- | --------------------------| ------------------------------------------------------------------------ |
* | Keep matching selections | `filter.regexp` | `a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/" , ... }]` |
* | Clear matching selections | `filter.regexp.inverse` | `s-a-k` (kakoune: normal) | `[".selections.filter", { defaultExpression: "/", inverse: true, ... }]` |
* | Clear secondary selections | `clear.secondary` | `,` (kakoune: normal) | `[".selections.filter", { expression: "i === count" , ... }]` |
* | Clear main selections | `clear.main` | `a-,` (kakoune: normal) | `[".selections.filter", { expression: "i !== count" , ... }]` |
*/
export function filter(
_: Context,
Expand Down

0 comments on commit 5779d9c

Please sign in to comment.