Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to the "emacs-mcx" extension will be documented in this file.

## [Unreleased]

### Add
- `emacs-mcx.enableDigitArgument` config, #1256.

## [0.40.1] - 2022-03-20
### Fix
- Release process, #1254.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ Note that this config makes use of VSCode API's `type` command under the hood an
* If you are using IME, text input may sometimes fail.
* If another extension that also uses the `type` command is installed, an error occurs (See https://github.com/Microsoft/vscode/issues/13441).

### `emacs-mcx.enableDigitArgument`
Indicates whether `M-<digit>` (the `emacs-mcx.digitArgument` command) is enabled.
Set `false` when `M-<digit>` conflicts with some other necessary commands. See https://github.com/whitphx/vscode-emacs-mcx/issues/1208 for the background.

### `emacs-mcx.debug.*`
Configurations for debugging.

Expand Down
13 changes: 11 additions & 2 deletions keybinding-generator/generate-keybindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export function generateKeybindings(src: KeyBindingSource): KeyBinding[] {
return keybindings;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function isKeyBindingSource(maybeSrc: { [key: string]: any }): maybeSrc is KeyBindingSource {
// Check for .key
if (typeof maybeSrc.key !== "undefined" && typeof maybeSrc.key !== "string") {
Expand Down Expand Up @@ -189,17 +190,25 @@ export function generateKeybindingsForPrefixArgument(): KeyBinding[] {
for (let num = 0; num <= 9; ++num) {
keybindings.push(
...generateKeybindings({
keys: [num.toString(), `meta+${num.toString()}`],
key: num.toString(),
command: "emacs-mcx.subsequentArgumentDigit",
when: "emacs-mcx.acceptingArgument && editorTextFocus",
args: [num],
})
);
keybindings.push(
...generateKeybindings({
key: `meta+${num.toString()}`,
command: "emacs-mcx.subsequentArgumentDigit",
when: "emacs-mcx.acceptingArgument && editorTextFocus && config.emacs-mcx.enableDigitArgument",
args: [num],
})
);
keybindings.push(
...generateKeybindings({
key: `meta+${num.toString()}`,
command: "emacs-mcx.digitArgument",
when: "!emacs-mcx.acceptingArgument && editorTextFocus",
when: "!emacs-mcx.acceptingArgument && editorTextFocus && config.emacs-mcx.enableDigitArgument",
args: [num],
})
);
Expand Down
Loading